Address Lior Silberman's report that the installer couldn't find, say, sh.exe if the containing folder ended in '\'.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10056 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-06-13 23:19:13 +00:00
parent e31df9c013
commit ed8ae86450
3 changed files with 95 additions and 16 deletions

View File

@ -298,7 +298,8 @@ go_on:
StrCpy ${FolderPath} "" StrCpy ${FolderPath} ""
ExecShell open "${URL}" ExecShell open "${URL}"
${else} ${else}
${StrTrim} ${FolderPath} ${StrTrim} ${FolderPath} ${FolderPath}
${StrRTrimChar} ${FolderPath} ${FolderPath} '\'
${if} ${FolderPath} == "" ${if} ${FolderPath} == ""
MessageBox MB_OK "${EnterFolder}" MessageBox MB_OK "${EnterFolder}"
@ -307,8 +308,9 @@ go_on:
${if} ${FileExists} "${FolderPath}" ${if} ${FileExists} "${FolderPath}"
${StrRep} ${FolderPath} ${FolderPath} "${ExeName}" "" ${StrRep} ${FolderPath} ${FolderPath} "${ExeName}" ""
${StrRTrimChar} ${FolderPath} ${FolderPath} '\'
${if} ${FileExists} "${FolderPath}${ExeName}" ${if} ${FileExists} "${FolderPath}\${ExeName}"
${else} ${else}
MessageBox MB_OK "${InvalidFolder}" MessageBox MB_OK "${InvalidFolder}"
Abort Abort

View File

@ -61,6 +61,9 @@ ${StrLoc}
${StrNSISToIO} ${StrNSISToIO}
${StrRep} ${StrRep}
${StrTrim} ${StrTrim}
${StrLTrim}
${StrRTrim}
${StrRTrimChar}
${ReadDownloadValues} ${ReadDownloadValues}
${EnableBrowseControls} ${EnableBrowseControls}
${SearchRegistry} ${SearchRegistry}
@ -369,7 +372,7 @@ Function DownloadMinSYS_LeaveFunction
$MinSYSPath \ $MinSYSPath \
"http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158803" \ "http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158803" \
"$(EnterMinSYSFolder)" \ "$(EnterMinSYSFolder)" \
"\sh.exe" \ "sh.exe" \
"$(InvalidMinSYSFolder)" "$(InvalidMinSYSFolder)"
FunctionEnd FunctionEnd
@ -403,7 +406,7 @@ Function DownloadPython_LeaveFunction
$PythonPath \ $PythonPath \
"http://www.python.org/download/" \ "http://www.python.org/download/" \
"$(EnterPythonFolder)" \ "$(EnterPythonFolder)" \
"\Python.exe" \ "Python.exe" \
"$(InvalidPythonFolder)" "$(InvalidPythonFolder)"
FunctionEnd FunctionEnd
@ -438,7 +441,7 @@ Function DownloadMiKTeX_LeaveFunction
$MiKTeXPath \ $MiKTeXPath \
"http://www.miktex.org/setup.html" \ "http://www.miktex.org/setup.html" \
"$(EnterMiKTeXFolder)" \ "$(EnterMiKTeXFolder)" \
"\latex.exe" \ "latex.exe" \
"$(InvalidMiKTeXFolder)" "$(InvalidMiKTeXFolder)"
FunctionEnd FunctionEnd
@ -473,7 +476,7 @@ Function DownloadPerl_LeaveFunction
$PerlPath \ $PerlPath \
"http://www.activestate.com/Products/ActivePerl/" \ "http://www.activestate.com/Products/ActivePerl/" \
"$(EnterPerlFolder)" \ "$(EnterPerlFolder)" \
"\perl.exe" \ "perl.exe" \
"$(InvalidPerlFolder)" "$(InvalidPerlFolder)"
FunctionEnd FunctionEnd
@ -524,7 +527,7 @@ Function DownloadGhostscript_LeaveFunction
$GhostscriptPath \ $GhostscriptPath \
"http://www.cs.wisc.edu/~ghost/doc/AFPL/index.htm" \ "http://www.cs.wisc.edu/~ghost/doc/AFPL/index.htm" \
"$(EnterGhostscriptFolder)" \ "$(EnterGhostscriptFolder)" \
"\gswin32c.exe" \ "gswin32c.exe" \
"$(InvalidGhostscriptFolder)" "$(InvalidGhostscriptFolder)"
FunctionEnd FunctionEnd
@ -559,7 +562,7 @@ Function DownloadImageMagick_LeaveFunction
$ImageMagickPath \ $ImageMagickPath \
"http://www.imagemagick.org/script/binary-releases.php" \ "http://www.imagemagick.org/script/binary-releases.php" \
"$(EnterImageMagickFolder)" \ "$(EnterImageMagickFolder)" \
"\convert.exe" \ "convert.exe" \
"$(InvalidImageMagickFolder)" "$(InvalidImageMagickFolder)"
FunctionEnd FunctionEnd

View File

@ -3,10 +3,13 @@
!include "lyxfunc.nsh" !include "lyxfunc.nsh"
!insertmacro LYX_DEFFUNC `StrLTrim`
!insertmacro LYX_DEFFUNC `StrRTrim`
!insertmacro LYX_DEFFUNC `StrTrim` !insertmacro LYX_DEFFUNC `StrTrim`
!insertmacro LYX_DEFFUNC `StrRTrimChar`
!macro LYX_FUNCTION_StrTrim !macro LYX_FUNCTION_StrLTrim
!insertmacro LYX_FUNC `StrTrim` !insertmacro LYX_FUNC `StrLTrim`
; After this point: ; After this point:
; $0 = String (input) ; $0 = String (input)
@ -22,12 +25,35 @@ Loop:
StrCmp "$1" "$\r" TrimLeft StrCmp "$1" "$\r" TrimLeft
StrCmp "$1" "$\n" TrimLeft StrCmp "$1" "$\n" TrimLeft
StrCmp "$1" " " TrimLeft ; this is a tab. StrCmp "$1" " " TrimLeft ; this is a tab.
GoTo Loop2 GoTo Done
TrimLeft: TrimLeft:
StrCpy $0 "$0" "" 1 StrCpy $0 "$0" "" 1
Goto Loop Goto Loop
Loop2: Done:
Pop $1
Exch $0
FunctionEnd
!macroend
!macro LYX_FUNCTION_StrLTrim_Call Output Input
Push `${Input}`
Call StrLTrim
Pop `${Output}`
!macroend
!macro LYX_FUNCTION_StrRTrim
!insertmacro LYX_FUNC `StrRTrim`
; After this point:
; $0 = String (input)
; $1 = Temp (temp)
; Get input from user
Exch $0
Push $1
Loop:
StrCpy $1 "$0" 1 -1 StrCpy $1 "$0" 1 -1
StrCmp "$1" " " TrimRight StrCmp "$1" " " TrimRight
StrCmp "$1" "$\r" TrimRight StrCmp "$1" "$\r" TrimRight
@ -36,7 +62,7 @@ Loop2:
GoTo Done GoTo Done
TrimRight: TrimRight:
StrCpy $0 "$0" -1 StrCpy $0 "$0" -1
Goto Loop2 Goto Loop
Done: Done:
Pop $1 Pop $1
@ -44,10 +70,58 @@ Done:
FunctionEnd FunctionEnd
!macroend !macroend
!macro LYX_FUNCTION_StrTrim_Call String !macro LYX_FUNCTION_StrRTrim_Call Output Input
Push `${String}` Push `${Input}`
Call StrRTrim
Pop `${Output}`
!macroend
!macro LYX_FUNCTION_StrTrim
!insertmacro LYX_FUNC `StrTrim`
Call StrLTrim
Call StrRTrim
FunctionEnd
!macroend
!macro LYX_FUNCTION_StrTrim_Call Output Input
Push `${Input}`
Call StrTrim Call StrTrim
Pop `${String}` Pop `${Output}`
!macroend
!macro LYX_FUNCTION_StrRTrimChar
!insertmacro LYX_FUNC `StrRTrimChar`
; After this point:
; $0 = Input
; $1 = Char
; $2 = Temp
; Get input from user
Exch $0
Exch
Exch $1
Push $2
StrCpy $2 "$0" 1 -1
StrCmp "$2" "$1" TrimRight
GoTo Done
TrimRight:
StrCpy $0 "$0" -1
Done:
Pop $2
Pop $1
Exch $0
FunctionEnd
!macroend
!macro LYX_FUNCTION_StrRTrimChar_Call Output Input Char
Push `${Char}`
Push `${Input}`
Call StrRTrimChar
Pop `${Output}`
!macroend !macroend
!endif ; _STRTRIM_NSH_ !endif ; _STRTRIM_NSH_