diff options
author | Karl Berry <karl@freefriends.org> | 2024-04-28 20:06:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-04-28 20:06:53 +0000 |
commit | 5fba95dca8837c90f7d628e1370181814b9d5cd7 (patch) | |
tree | ff2c6b81ff1c3e83272f5e25f12b16e2dd9963cb /Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm | |
parent | 8d220425254aa4d86b34c732a369be2abaafe091 (diff) |
latexindent (28apr24)
git-svn-id: svn://tug.org/texlive/trunk@71114 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm')
-rw-r--r-- | Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm index b35795f70a5..477c5da68f7 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm @@ -272,12 +272,19 @@ sub output_logfile { if ${ $mainSettings{logFilePreferences} }{showGitHubInfoFooter}; # open log file - my $logfileName = $switches{logFileName} || "indent.log"; - my $logfilePossible = 1; - my $logfile = open_with_encode( '>:encoding(UTF-8)', "${$self}{cruftDirectory}/$logfileName" ) - or $logfilePossible = 0; + my $logfileName = $switches{logFileName} || "indent.log"; + + my $logfilePath; + $logfilePath = "${$self}{cruftDirectory}/$logfileName"; + $logfilePath =~ s/\\/\//g; + $logfilePath =~ s/\/{2,}/\//g; + if ( $^O eq 'MSWin32' ) { + $logfilePath =~ s/\//\\/g; + } + + my $logfile = open_with_encode( '>:encoding(UTF-8)', $logfilePath ); - if ($logfilePossible) { + if ($logfile) { foreach my $line ( @{LatexIndent::Logger::logFileLines} ) { print $logfile $line, "\n"; } @@ -285,7 +292,12 @@ sub output_logfile { # close log file close($logfile); } - + else { + if ( $switches{screenlog} ) { + print "WARN: Could not open the logfile $logfilePath \n"; + print " No logfile will be produced.\n"; + } + } } sub process_body_of_text { |