Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
plotID_matlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plotID
plotID_matlab
Commits
d76e6051
Commit
d76e6051
authored
3 years ago
by
Lemmer, Jan
Browse files
Options
Downloads
Plain Diff
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
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!62
Introduce changes for V1.0 RC 1
,
!60
Implements #43
Pipeline
#654734
passed
3 years ago
Stage: Run
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
+PlotID/createFileCopy.m
+25
-23
25 additions, 23 deletions
+PlotID/createFileCopy.m
with
25 additions
and
23 deletions
+PlotID/createFileCopy.m
+
25
−
23
View file @
d76e6051
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment