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

Use Export Path from config file

parent 83fcb8ff
No related branches found
No related tags found
2 merge requests!43Implements #73, cleans up example file,,!36Resolve "Initialise: Angabe des Ordners ohne Effekt"
Pipeline #592863 passed
...@@ -12,6 +12,7 @@ classdef config < handle ...@@ -12,6 +12,7 @@ classdef config < handle
properties (SetAccess = protected) properties (SetAccess = protected)
configData configData
configFileName configFileName
exportPath = ''
end end
methods methods
...@@ -23,7 +24,10 @@ classdef config < handle ...@@ -23,7 +24,10 @@ classdef config < handle
txt = fileread(obj.configFileName); txt = fileread(obj.configFileName);
obj.configData = jsondecode(txt); obj.configData = jsondecode(txt);
assert(checkConfig(obj)); assert(checkConfig(obj));
if isfield(obj.configData,'ExportPath')
obj.exportPath = obj.configData.ExportPath;
obj.configData.options.Location = 'exportPath';
end
catch catch
msg = ['no valid config File with the filename ',... msg = ['no valid config File with the filename ',...
obj.configFileName, ' found.' newline,... obj.configFileName, ' found.' newline,...
......
...@@ -15,7 +15,7 @@ switch mode ...@@ -15,7 +15,7 @@ switch mode
m = input('Do you want to add an export path? Y/N [Y]:','s'); m = input('Do you want to add an export path? Y/N [Y]:','s');
if ismember(m,{'Y','y'}) if ismember(m,{'Y','y'})
config.ServerPath = uigetdir(); config.ExportPath = uigetdir();
end end
otherwise otherwise
error('wizard mode undefined in CLASS config'); error('wizard mode undefined in CLASS config');
......
...@@ -74,9 +74,13 @@ end ...@@ -74,9 +74,13 @@ end
%% read config file %% read config file
% there is only one config Object (handleClass) % there is only one config Object (handleClass)
configObj = PlotID.config(options.ConfigFileName); configObj = PlotID.config(options.ConfigFileName);
% add user options
if isfield(configObj.configData, 'options') if isfield(configObj.configData, 'options')
% is working but prune to user errors fldnames = fieldnames(configObj.configData.options);
options = configObj.configData.options; for ii=1:numel(fldnames)
field = fldnames{ii};
options.(field) = configObj.configData.options.(field);
end
end end
% Error and MSG handeling % Error and MSG handeling
...@@ -92,14 +96,22 @@ switch options.Location ...@@ -92,14 +96,22 @@ switch options.Location
% use the script path as export path % use the script path as export path
scriptLocation = fileparts(scriptPath); scriptLocation = fileparts(scriptPath);
storPath = fullfile(scriptLocation,options.ParentFolder); storPath = fullfile(scriptLocation,options.ParentFolder);
end
case 'exportPath' %legacy
if isfolder(configObj.exportPath)
storPath = configObj.exportPath;
else
msg = ['Your Export folder ', storPath, newline,...
'does not exist - publishing not possible'];
dlgObj.error(msg);
end end
case 'server' %from config File case 'server' %legacy
if dlgObj.configError if dlgObj.configError
msg = ['Error while reading the config file' newline,... msg = ['Error while reading the config file' newline,...
' publishing on server not possible']; ' publishing on server not possible'];
dlgObj.error(msg); dlgObj.error(msg);
end end
storPath = config.ServerPath; storPath = configObj.configData.ServerPath;
case 'manual' %UI case 'manual' %UI
storPath = uigetdir(); storPath = uigetdir();
case 'CI-Test' case 'CI-Test'
...@@ -258,7 +270,7 @@ if dlgObj.success || options.ForcePublish ...@@ -258,7 +270,7 @@ if dlgObj.success || options.ForcePublish
end end
if status if status
disp(['publishing of ', ID , ' done']); %always displayed onsucess disp(['publishing of ', ID , ' to ', newPath, ' done']); %always displayed onsucess
else % publish was not sucessfull! else % publish was not sucessfull!
%replace with error from userDLG Class %replace with error from userDLG Class
dlgObj.error(['publishing of ', ID , ' failed']) dlgObj.error(['publishing of ', ID , ' failed'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment