Hello,
spaces in the name of a logfile would lead to unexpected results.
The problem is that filenames are not protected by (double-)quotes before using the "system" command.
My (dirty?) solution is to add double-quotes in "RunOpenEMS.m".
See the file excerpt below.
I hope you find this useful.
Cheers
Frank
Excerpt "RunOpenEMS.m":
...
else
args = ["\"" Sim_File "\"" ' ' opts];
if isfield(Settings,'LogFile') && isfield(Settings,'Silent')
invoke_openEMS(args,["\"" Settings.LogFile "\""],Settings.Silent);
elseif isfield(Settings,'LogFile')
invoke_openEMS(args,["\"" Settings.LogFile "\""]);
elseif isfield(Settings,'Silent')
invoke_openEMS(args,[],Settings.Silent);
else
invoke_openEMS(args);
end
end
cd(savePath);
return
Spaces in logfile name
Moderators: thorsten, sebastian
Re: Spaces in logfile name
Using quotes for a command line does not sound like a dirty trick but common sense?
Therefore I think this is a reasonable fix for an otherwise unexpected/broken behavior...
regards
Thorsten
Therefore I think this is a reasonable fix for an otherwise unexpected/broken behavior...
regards
Thorsten
Re: Spaces in logfile name
Hi,
using quotes is of course fine.
But I am not so sure that I added them in the right file.
There might be a better place.
And I did not systematically search for other files that might need editing.
(Actually, this last comment also applies to my Windows powershell edit for the logfile.)
Cheers
Frank
using quotes is of course fine.
But I am not so sure that I added them in the right file.
There might be a better place.
And I did not systematically search for other files that might need editing.
(Actually, this last comment also applies to my Windows powershell edit for the logfile.)
Cheers
Frank
Re: Spaces in logfile name
To follow up this topic, attached is my edited "RunOpenEMS.m".
Looking at "RunOpenEMS.m" and "RunOpenEMS_MPI.m", there are several other calls of "system" or "unix" commands where I believe they would break if there are spaces in file names or paths. But I cannot test these cases. Thus I do not dare to edit them.
Cheers
Frank
Looking at "RunOpenEMS.m" and "RunOpenEMS_MPI.m", there are several other calls of "system" or "unix" commands where I believe they would break if there are spaces in file names or paths. But I cannot test these cases. Thus I do not dare to edit them.
Cheers
Frank
- Attachments
-
RunOpenEMS.m
- Prevent some failures if spaces are used in log files or sim files.
- (6.57 KiB) Downloaded 386 times