Skip to content
Snippets Groups Projects
Commit 5e3e7f0e authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Implements #96

parent 4084e264
No related branches found
No related tags found
2 merge requests!62Introduce changes for V1.0 RC 1,!55Implements #96
function pList = copyUserFCN(scriptPath, folderName, storPath, ID)
%COPYUSERFCN copies all user functions, classes and toolboxes that are used
%by the base script (scriptpath).
% folderName, storPath and ID are required for createfilecopy
[fList,pList] = matlab.codetools.requiredFilesAndProducts(scriptPath);
fList = fList(~ismember(fList,scriptPath)); % rmv plot script itself from list
fList = fList(~contains(fList,'config.json')); % rmv config.json from list
fList = removePltIdFiles(fList); % Do not copy files that are part of PlotID
% copy Classes and Toolboxes as a whole
copyTBorClass(fList,'+', folderName, storPath, ID); % Toolboxes
copyTBorClass(fList,'@', folderName, storPath, ID); % Classes
%remove class and toolbox files from flist
fList = fList(~contains(fList,{'@','+'}));
% copy User FCN
if ~isempty(fList)
PlotID.createFileCopy(fList,folderName,storPath,ID,'userFcn');
end
......@@ -32,4 +43,18 @@ function [fListClean] = removePltIdFiles(fList)
PltID_flist = [packageContent.m; Class_flist];
% Comparison and filter
fListClean = fList(~ismember(names,PltID_flist));
end
function [status, msg] = copyTBorClass(fList,leadChar, folderName, storPath, ID)
%copyTBorClass copies the Toolboxes or Classes that are part of flist
% lead char must be either '@' for Classes or '+' for Toolboxes
if any(contains(fList,leadChar))
list = fList(contains(fList, leadChar));
names = extractBetween(list,leadChar,filesep);
paths = extractBefore(list,strcat(leadChar,names));
fullPaths = strcat(paths,strcat(leadChar,names));
fullPaths = unique(fullPaths);
[~, status, msg] =PlotID.createFileCopy(fullPaths,...
folderName,storPath,ID,'class');
end %if
end
\ No newline at end of file
......@@ -29,6 +29,8 @@ end
case 'userFcn'
%keep original name
newfile = sprintf([name,ext]);
case {'class','toolbox'}
newfile = name; % copy whole folder
otherwise
error([type,' is not a valid type for createFileCopy'])
end %switch
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment