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

Merge branch...

Merge branch '38-bug-filename-already-exists-in-data-folder-although-the-comparison-chose-no-identical-file' into 'development'

fixes #38

See merge request fst-tuda/projects/nfdi4ing/projects/plot_identifier!9
parents a2133489 be054396
Branches
Tags
3 merge requests!13PreRelease_V0.1,!12PreRelease_V0.1,!9fixes #38
Pipeline #561501 failed
......@@ -128,8 +128,7 @@ switch options.Method
fList.path = fullfile(fList.folder,fList.name);
sourcePath = fList{idx,'path'};
relativeSourcePath = strrep(sourcePath,currentPath,'');
%WIP relative PATh!!
if contains(sourcePath,{'.h5','.hdf5'}) % Linking only for HDF5
PlotID.createLinkedHDF5(relativeSourcePath{1,1},storPath,ID);
end
......
......@@ -34,7 +34,6 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type)
error([type,' is not a valid type for createFileCopy'])
end %switch
% Write the file
RemotePath = fullfile(storPath,folderName, newfile);
% Check if remote file already exists
......@@ -50,8 +49,22 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type)
else
RemotePath = fullfile(storPath,folderName,...
[name(1:end-length(num2str(count))),num2str(count),ext]);
end
warning('Filename already exists in data folder');
end
[~, name, ~] = 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.'];
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
copyfile(FileNameAndLocation,RemotePath);
storagePaths{i} = RemotePath;
......@@ -59,6 +72,8 @@ function [storagePaths] = createFileCopy(filePaths,folderName,storPath,ID,type)
disp([type, ' sucessfully published']);
catch
warning([type,' export was not sucessful'])
if exist('errorMSG')
error(errorMSG);
end %try
end
......@@ -26,23 +26,6 @@ for i=1:height(fileList)
filepath = fullfile(fileList{i,'folder'},fileList{i,'name'});
%% old
%crucial performance due to matlab bug
%(see https://de.mathworks.com/matlabcentral/answers/338553-performance-of-system-dos-function)
% if ispc
% filename = ['"',filename,'"'];% Bugfix for spaces in path
% status = comparejava
% % system call that causes performance issues
% [status,~] = system(['fc ' filename ' ' char(filepath)]);
% % 0 -> identical, 1 -> not identical
% status = ~status; % false (not identical), true(identical)
%
% elseif isunix %untested!
% [status,~] = system(['diff ' filename ' ' filepath]);
% else
% warning('Platform not supported')
% end
%% comparison with java function
% TODO test paths with spaces
status = comparejava(filename, char(filepath));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment