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
properties (SetAccess = protected)
configData
configFileName
exportPath = ''
end
methods
......@@ -23,7 +24,10 @@ classdef config < handle
txt = fileread(obj.configFileName);
obj.configData = jsondecode(txt);
assert(checkConfig(obj));
if isfield(obj.configData,'ExportPath')
obj.exportPath = obj.configData.ExportPath;
obj.configData.options.Location = 'exportPath';
end
catch
msg = ['no valid config File with the filename ',...
obj.configFileName, ' found.' newline,...
......
......@@ -15,7 +15,7 @@ switch mode
m = input('Do you want to add an export path? Y/N [Y]:','s');
if ismember(m,{'Y','y'})
config.ServerPath = uigetdir();
config.ExportPath = uigetdir();
end
otherwise
error('wizard mode undefined in CLASS config');
......
......@@ -74,9 +74,13 @@ end
%% read config file
% there is only one config Object (handleClass)
configObj = PlotID.config(options.ConfigFileName);
% add user options
if isfield(configObj.configData, 'options')
% is working but prune to user errors
options = configObj.configData.options;
fldnames = fieldnames(configObj.configData.options);
for ii=1:numel(fldnames)
field = fldnames{ii};
options.(field) = configObj.configData.options.(field);
end
end
% Error and MSG handeling
......@@ -92,14 +96,22 @@ switch options.Location
% use the script path as export path
scriptLocation = fileparts(scriptPath);
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
case 'server' %from config File
case 'server' %legacy
if dlgObj.configError
msg = ['Error while reading the config file' newline,...
' publishing on server not possible'];
dlgObj.error(msg);
end
storPath = config.ServerPath;
storPath = configObj.configData.ServerPath;
case 'manual' %UI
storPath = uigetdir();
case 'CI-Test'
......@@ -258,7 +270,7 @@ if dlgObj.success || options.ForcePublish
end
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!
%replace with error from userDLG Class
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