Skip to content

Commit

Permalink
update overwrite logic
Browse files Browse the repository at this point in the history
  • Loading branch information
teddy.chao committed Sep 7, 2023
1 parent ccbf3c8 commit 10e7db6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/pspm_overwrite.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
overwrite_final = overwrite;
case 'struct'
overwrite_struct = overwrite;
if isfield(overwrite_struct, 'overwrite')
overwrite_final = overwrite_struct.overwrite;
if ~exist(fn, 'file')
% if file does not exist, always **overwrite**
overwrite_final = 1;
else
if ~exist(fn, 'file')
% if file does not exist, always **overwrite**
overwrite_final = 1;
if isfield(overwrite_struct, 'overwrite')
overwrite_final = overwrite_struct.overwrite;
else
overwrite_final = 0;
end
Expand Down
4 changes: 3 additions & 1 deletion test/pspm_load1_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function generate_testdata(this)
this.modelfiles{i} = mfn;
this.dummyfiles{i} = dfn;
fh = str2func(['pspm_', settings.first{i}]);
fh(model);
options = struct();
options.overwrite = 1;
fh(model, options);
copyfile(this.modelfiles{i}, this.dummyfiles{i});
end
end
Expand Down

0 comments on commit 10e7db6

Please sign in to comment.