Skip to content

Commit cd74c24

Browse files
authored
Merge pull request #29 from edgar79/batch-file-CRLF
replace LFCR by CRLF in windows batch file
2 parents 9370c3b + 4b8c40b commit cd74c24

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

extension/OOoLilyPond/LilyPond.xba

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Function CallLilyPond() As Boolean
8282

8383
ElseIf sOSType = "Windows" Then
8484

85-
sCommand = "cd /d " & Chr(34) & ConvertFromURL(sTmpPath) & Chr(34) & Chr(10) & Chr(13) _
85+
sCommand = "cd /d " & Chr(34) & ConvertFromURL(sTmpPath) & Chr(34) & Chr(13) & Chr(10) _
8686
& Chr(34) & sLilyPondExecutable & Chr(34) & " -dno-point-and-click"
8787
If Len(sIncludeStatement) > 0 Then
8888
sCommand = sCommand & " " & sIncludeStatement
@@ -91,21 +91,21 @@ Function CallLilyPond() As Boolean
9191
If bTransparentBackground Then
9292
sCommand = sCommand & " -dno-delete-intermediate-files -dpixmap-format=pngalpha --png " & sBackendOpt & " -dresolution=" _
9393
& iGraphicDPI & " "& Chr(34) & ConvertFromURL(sTmpPath) & constOLyFileName & ".ly" & Chr (34) _
94-
& " >" & constOLyFileName & ".out 2>&1" & Chr(10) & Chr(13)
94+
& " >" & constOLyFileName & ".out 2>&1" & Chr(13) & Chr(10)
9595
Else
9696
sCommand = sCommand & " -dno-delete-intermediate-files --png " & sBackendOpt & " -dresolution=" _
9797
& iGraphicDPI & " " & Chr(34) & ConvertFromURL(sTmpPath) & constOLyFileName & ".ly" & Chr (34) _
98-
& " >" & constOLyFileName & ".out 2>&1" & Chr(10) & Chr(13)
98+
& " >" & constOLyFileName & ".out 2>&1" & Chr(13) & Chr(10)
9999
End If
100100
ElseIf sFormat="eps" Then
101101
sCommand = sCommand & " " & sBackendOpt & " -f eps " & Chr(34) & ConvertFromURL(sTmpPath) & constOLyFileName & ".ly" & Chr (34) _
102-
& " >" & constOLyFileName & ".out 2>&1" & Chr(10) & Chr(13)
102+
& " >" & constOLyFileName & ".out 2>&1" & Chr(13) & Chr(10)
103103
ElseIf sFormat="svg" Then
104104
sCommand = sCommand & " " & sBackendOpt & " " & Chr(34) & ConvertFromURL(sTmpPath) & constOLyFileName & ".ly" & Chr (34) _
105-
& " >" & constOLyFileName & ".out 2>&1" & Chr(10) & Chr(13)
105+
& " >" & constOLyFileName & ".out 2>&1" & Chr(13) & Chr(10)
106106
End If
107-
sCommand=sCommand & "if %ERRORLEVEL% equ 9009 echo cannot execute >LilyPond-cannot_execute" & Chr(10) & Chr(13) _
108-
& "if %ERRORLEVEL% equ 3 echo cannot execute >LilyPond-cannot_execute" & Chr(10) & Chr(13)
107+
sCommand=sCommand & "if %ERRORLEVEL% equ 9009 echo cannot execute >LilyPond-cannot_execute" & Chr(13) & Chr(10) _
108+
& "if %ERRORLEVEL% equ 3 echo cannot execute >LilyPond-cannot_execute" & Chr(13) & Chr(10)
109109
'ToDo: 9009 and 3 OK? Other errors? Wrong Permissions?
110110
WindowsCommand(sCommand)
111111

extension/OOoLilyPond/Tools.xba

100755100644
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,9 @@ Sub WindowsCommand(sCommand as String)
356356

357357
'Set CodePage to 65001 - which is UTF-8 (Supports any except bidirectional and scripted languages)
358358
oTextStream.setEncoding("utf-8")
359-
oTextStream.writeString( Chr(10) & Chr(13) )
360-
oTextStream.writeString("chcp 65001" & Chr(10) & Chr(13) & sCommand)
359+
'Windows/LibreOffice writes a 2-byte BOM to mark an UTF-8 file: Skip to first statement with a new line
360+
oTextStream.writeString( Chr(13) & Chr(10) )
361+
oTextStream.writeString("chcp 65001" & Chr(13) & Chr(10) & sCommand)
361362
oTextStream.closeOutput()
362363

363364
Shell (sBatFile, 6, "", True) ' Window-code 6 : only show symbol and leave focus on the current window

0 commit comments

Comments
 (0)