Skip to content
Snippets Groups Projects

Draft: FIX bug that causes Error when COPYUSER FCN is off and a broken

Merged Lemmer, Jan requested to merge development into master
7 files
+ 46
47
Compare changes
  • Side-by-side
  • Inline
Files
7
+ 19
15
@@ -10,13 +10,13 @@ function Publish(DataPaths,scriptPath, figure, options)
% Location sets the storage location. 'local' sets the storage location
% to the current folder (an export folder will be created), 'manual' opens
% a explorer window, where you can choose the folder. If you define a export
% path in the config file, this will used per default.
% path in the config file, this will used per defaul (exportPath).
% remote path, that is defined in the config file.
% Two Methods are implemented 'individual' stores the data for
% each plot while 'centralized' uses a data folder and uses reference links
% to the original data (hdf5 only).
% 'ParentFolder' is the folder Name where the exported data is stored if an
% path is used, PlotId will use this path a storagePath
% path is used, PlotId will use this path as storagePath
% 'ConfigFileName' is needed for handling multiple config files (see example)
% 'CSV' turns a summary table of all exports on or off
%
@@ -27,9 +27,9 @@ function Publish(DataPaths,scriptPath, figure, options)
arguments
DataPaths {mustBeDataPath} % location of the data-file(s)
scriptPath (1,:) {mustBeFile} % location of the matlab script
scriptPath (1,:) {mustBeText} % location of the matlab script
figure (1,:) {mustBeFigure} % Checks if figure is a figure object
options.Location {mustBeMember(options.Location ,{'local','server','manual','CI-Test'})} = 'local' % storage path
options.Location {mustBeMember(options.Location ,{'local','exportPath','manual','CI-Test'})} = 'local' % storage path
options.Method {mustBeMember(options.Method ,{'individual','centralized'})} = 'individual'
options.ParentFolder (1,:) {mustBeText} = 'PlotID_export' % name of the ParentFolder
options.ConfigFileName (1,:) {mustBeText} = 'config.json' %individual config names possible
@@ -66,6 +66,16 @@ if numel(figure) > 1
warning(msg);
end
% find scriptpath
if ~isfile(scriptPath)
scriptPath= which(['/',scriptPath]);
if ~isfile(scriptPath)
msg = ['Script path: ',scriptPath, ' not found on matlab path', newline, ...
'- check spelling or us a path'];
error(msg);
end
end
% catch missing .m extension
[~,~, scriptExt] = fileparts(scriptPath);
if isempty(scriptExt)
@@ -118,13 +128,6 @@ switch options.Location
'does not exist, check the config file - publishing not possible!'];
dlgObj.error(msg);
end
case 'server' %legacy
if dlgObj.configError
msg = ['Error while reading the config file' newline,...
' publishing on server not possible'];
dlgObj.error(msg);
end
storPath = configObj.configData.ServerPath;
case 'manual' %UI
storPath = uigetdir();
case 'CI-Test' %only for CI tests
@@ -165,8 +168,8 @@ dlgObj.scriptPublished =status;
dlgObj.userMSG(msg);
% user functions
[fList,pList] = matlab.codetools.requiredFilesAndProducts(scriptPath);
if options.CopyUserFCN
if options.CopyUserFCN
[fList,pList] = matlab.codetools.requiredFilesAndProducts(scriptPath);
fList = fList(~ismember(fList,scriptPath)); % rmv script from list
fList = fList(~contains(fList,'config.json')); % rmv config.json from list
fList = PlotID.removePltIdFiles(fList); % Do not copy files that are part of PlotID
@@ -243,8 +246,9 @@ end
meta.ProjectID = ID;
meta.CreationDate = datestr(now);
meta.MatlabVersion = version;
meta.ToolboxVersions = pList;
if options.CopyUserFCN
meta.ToolboxVersions = pList;
end
% write meta
metaPath = fullfile(storPath,folderName,'plotID_data.json');
fid = fopen(char(metaPath),'w');
Loading