Skip to content

Commit

Permalink
Bugfix: Exporting subject was not restoring original protocol.mat
Browse files Browse the repository at this point in the history
  • Loading branch information
ftadel committed May 7, 2020
1 parent f65ca80 commit f3c919e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/license.html
Expand Up @@ -5,7 +5,7 @@
<body alink="#fff000" link="#fff000" vlink="#fff000">
<h4><span style="font-family: Arial Black; color: #ffffff;"><strong>THERE IS NO UNDO BUTTON - SET UP A BACKUP OF YOUR DATABASE</strong></span></h4>
<HR>
<!-- LICENCE_START -->Version: 3.200505 (05-May-2020)<br>
<!-- LICENCE_START -->Version: 3.200507 (07-May-2020)<br>
<span style="font-style: italic;">COPYRIGHT &copy; 2000-2020
USC &amp; McGill University.<br>
</span>
Expand Down
2 changes: 1 addition & 1 deletion doc/version.txt
@@ -1,2 +1,2 @@
% Brainstorm
% v. 3.200505 (05-May-2020)
% v. 3.200507 (07-May-2020)
9 changes: 7 additions & 2 deletions toolbox/io/export_protocol.m
Expand Up @@ -107,6 +107,7 @@ function export_protocol(iProtocol, iSubject, OutputFile)
ProtocolMat.LastAccessDate = datestr(now);
ProtocolMat.LastAccessUserDir = bst_get('UserDir');
% Remove useless fields
StudyDir = ProtocolMat.ProtocolInfo.STUDIES;
ProtocolMat.ProtocolInfo = rmfield(ProtocolMat.ProtocolInfo, 'STUDIES');
ProtocolMat.ProtocolInfo = rmfield(ProtocolMat.ProtocolInfo, 'SUBJECTS');
ProtocolMat.ProtocolSubjects.Subject = ProtocolMat.ProtocolSubjects.Subject(iSubject);
Expand All @@ -124,9 +125,13 @@ function export_protocol(iProtocol, iSubject, OutputFile)
end
% Zip
zip(OutputFile, ListZip);
% Remove temporary protocol file
% Restore protocol file
if ~isempty(iSubject)
file_delete(ProtocolFile, 1);
% Remove temporary protocol file
file_delete(bst_fullfile(StudyDir, 'protocol.mat'), 1);
% Save again the original one
GlobalData.DataBase.isProtocolModified(iProtocol) = 1;
db_save(1);
end
% Restore initial folder
cd(prevFolder);
Expand Down

0 comments on commit f3c919e

Please sign in to comment.