Skip to content

Commit 1535190

Browse files
committed
Avoid an "invalid escape-char" warning upon error
1 parent 26eb699 commit 1535190

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

append_pdfs.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
% files when appending (Javier Paredes); sanity check of inputs
3737
% 24/01/18: Fixed error in case of existing output file (append mode)
3838
% 24/01/18: Fixed issue #213: non-ASCII characters in folder names on Windows
39+
% 06/12/18: Avoid an "invalid escape-char" warning upon error
3940

4041
function append_pdfs(varargin)
4142

@@ -75,7 +76,7 @@ function append_pdfs(varargin)
7576
[status, errMsg] = ghostscript(['@"' cmdfile '"']);
7677

7778
% Check for ghostscript execution errors
78-
if status && ~isempty(strfind(errMsg,'undefinedfile')) && ispc
79+
if status && ~isempty(strfind(errMsg,'undefinedfile')) && ispc %#ok<STREMP>
7980
% Fix issue #213: non-ASCII characters in folder names on Windows
8081
for fileIdx = 2 : numel(varargin)
8182
[fpath,fname,fext] = fileparts(varargin{fileIdx});
@@ -91,6 +92,7 @@ function append_pdfs(varargin)
9192

9293
% Check for ghostscript execution errors
9394
if status
95+
errMsg = strrep(errMsg,'\','\\'); % Avoid an "invalid escape-char" warning
9496
error('YMA:export_fig:append_pdf',errMsg);
9597
end
9698

0 commit comments

Comments
 (0)