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

Merge branch '43-mehrfache-nachfrage-nach-suffix-bei-einer-dateioperation' into 'development'

Implements #43

See merge request !60
parents 7e51976c fa62d60f
No related branches found
No related tags found
2 merge requests!62Introduce changes for V1.0 RC 1,!60Implements #43
Pipeline #654734 passed
......@@ -38,38 +38,40 @@ end
RemotePath = fullfile(storPath,folderName, newfile);
% Check if remote file already exists
count = 0;
while isfile(RemotePath) && ismember(type,{'data','dataCentral'})
% Add a Sufix number to new file name
% TODO add more inteligent way then a simple sufix
count = count + 1;
[~,name,ext] = fileparts(RemotePath);
if count < 2
RemotePath = fullfile(storPath,folderName,...
[name,'_',num2str(count),ext]);
else
RemotePath = fullfile(storPath,folderName,...
[name(1:end-length(num2str(count))),num2str(count),ext]);
end
[~, name, ~] = fileparts(RemotePath);
if isfile(RemotePath) && ismember(type,{'data','dataCentral'})
% Add a Sufix number to new file name
[~,name,ext] = fileparts(RemotePath);
msg = ['Filename ',name,...
' already exists in the data folder' newline,...
' PlotID will add an suffix if you continue.' newline,...
' This can cause serious confusions.'];
% User Dialog
msg = ['Filename ',name, ' already exists in the data folder' newline,...
' PlotID will add an suffix if you continue.' newline,...
' This can cause serious confusions.'];
warning(msg);
m = input('Do you want to continue, Y/N [Y]:','s');
if ismember(m,{'N','n'})
errorMSG = ['Filename already exists in data folder.' newline,...
' Rename the File and restart PlotID.'];
error();
end
end
error(errorMSG);
end
% add sufix
RemotePath = fullfile(storPath,folderName,...
[name,'_1',ext]);
% auto count until a sufix is reached that did not
% exist. (User is only asked once)
count = 0;
while isfile(RemotePath)
count = count + 1;
[~,name,~] = fileparts(RemotePath);
RemotePath = fullfile(storPath,folderName,...
[name(1:end-length(num2str(count-1))),num2str(count),ext]);
end
end%if
copyfile(FileNameAndLocation,RemotePath);
storagePaths{i} = RemotePath;
end
end %for
status = true;
msg =([type, ' successfully published']);
% catch
......
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