diff --git a/development/Win32/packaging/installer/download.nsh b/development/Win32/packaging/installer/download.nsh index 7f4798833b..3382c50d36 100644 --- a/development/Win32/packaging/installer/download.nsh +++ b/development/Win32/packaging/installer/download.nsh @@ -298,7 +298,8 @@ go_on: StrCpy ${FolderPath} "" ExecShell open "${URL}" ${else} - ${StrTrim} ${FolderPath} + ${StrTrim} ${FolderPath} ${FolderPath} + ${StrRTrimChar} ${FolderPath} ${FolderPath} '\' ${if} ${FolderPath} == "" MessageBox MB_OK "${EnterFolder}" @@ -307,8 +308,9 @@ go_on: ${if} ${FileExists} "${FolderPath}" ${StrRep} ${FolderPath} ${FolderPath} "${ExeName}" "" + ${StrRTrimChar} ${FolderPath} ${FolderPath} '\' - ${if} ${FileExists} "${FolderPath}${ExeName}" + ${if} ${FileExists} "${FolderPath}\${ExeName}" ${else} MessageBox MB_OK "${InvalidFolder}" Abort diff --git a/development/Win32/packaging/installer/lyx_installer.nsi b/development/Win32/packaging/installer/lyx_installer.nsi index 1e5038b930..2340150519 100644 --- a/development/Win32/packaging/installer/lyx_installer.nsi +++ b/development/Win32/packaging/installer/lyx_installer.nsi @@ -61,6 +61,9 @@ ${StrLoc} ${StrNSISToIO} ${StrRep} ${StrTrim} +${StrLTrim} +${StrRTrim} +${StrRTrimChar} ${ReadDownloadValues} ${EnableBrowseControls} ${SearchRegistry} @@ -369,7 +372,7 @@ Function DownloadMinSYS_LeaveFunction $MinSYSPath \ "http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158803" \ "$(EnterMinSYSFolder)" \ - "\sh.exe" \ + "sh.exe" \ "$(InvalidMinSYSFolder)" FunctionEnd @@ -403,7 +406,7 @@ Function DownloadPython_LeaveFunction $PythonPath \ "http://www.python.org/download/" \ "$(EnterPythonFolder)" \ - "\Python.exe" \ + "Python.exe" \ "$(InvalidPythonFolder)" FunctionEnd @@ -438,7 +441,7 @@ Function DownloadMiKTeX_LeaveFunction $MiKTeXPath \ "http://www.miktex.org/setup.html" \ "$(EnterMiKTeXFolder)" \ - "\latex.exe" \ + "latex.exe" \ "$(InvalidMiKTeXFolder)" FunctionEnd @@ -473,7 +476,7 @@ Function DownloadPerl_LeaveFunction $PerlPath \ "http://www.activestate.com/Products/ActivePerl/" \ "$(EnterPerlFolder)" \ - "\perl.exe" \ + "perl.exe" \ "$(InvalidPerlFolder)" FunctionEnd @@ -524,7 +527,7 @@ Function DownloadGhostscript_LeaveFunction $GhostscriptPath \ "http://www.cs.wisc.edu/~ghost/doc/AFPL/index.htm" \ "$(EnterGhostscriptFolder)" \ - "\gswin32c.exe" \ + "gswin32c.exe" \ "$(InvalidGhostscriptFolder)" FunctionEnd @@ -559,7 +562,7 @@ Function DownloadImageMagick_LeaveFunction $ImageMagickPath \ "http://www.imagemagick.org/script/binary-releases.php" \ "$(EnterImageMagickFolder)" \ - "\convert.exe" \ + "convert.exe" \ "$(InvalidImageMagickFolder)" FunctionEnd diff --git a/development/Win32/packaging/installer/strtrim.nsh b/development/Win32/packaging/installer/strtrim.nsh index a5857395b0..8a5af35211 100644 --- a/development/Win32/packaging/installer/strtrim.nsh +++ b/development/Win32/packaging/installer/strtrim.nsh @@ -3,10 +3,13 @@ !include "lyxfunc.nsh" +!insertmacro LYX_DEFFUNC `StrLTrim` +!insertmacro LYX_DEFFUNC `StrRTrim` !insertmacro LYX_DEFFUNC `StrTrim` +!insertmacro LYX_DEFFUNC `StrRTrimChar` -!macro LYX_FUNCTION_StrTrim - !insertmacro LYX_FUNC `StrTrim` +!macro LYX_FUNCTION_StrLTrim + !insertmacro LYX_FUNC `StrLTrim` ; After this point: ; $0 = String (input) @@ -22,12 +25,35 @@ Loop: StrCmp "$1" "$\r" TrimLeft StrCmp "$1" "$\n" TrimLeft StrCmp "$1" " " TrimLeft ; this is a tab. - GoTo Loop2 + GoTo Done TrimLeft: StrCpy $0 "$0" "" 1 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 StrCmp "$1" " " TrimRight StrCmp "$1" "$\r" TrimRight @@ -36,7 +62,7 @@ Loop2: GoTo Done TrimRight: StrCpy $0 "$0" -1 - Goto Loop2 + Goto Loop Done: Pop $1 @@ -44,10 +70,58 @@ Done: FunctionEnd !macroend -!macro LYX_FUNCTION_StrTrim_Call String - Push `${String}` +!macro LYX_FUNCTION_StrRTrim_Call Output Input + 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 - 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 !endif ; _STRTRIM_NSH_