mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
Separate out the searching of the registry stuff so that it is all performed in onInit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10045 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8ee40f1208
commit
f81ac590cb
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
!insertmacro LYX_DEFFUNC `ReadDownloadValues`
|
!insertmacro LYX_DEFFUNC `ReadDownloadValues`
|
||||||
!insertmacro LYX_DEFFUNC `EnableBrowseControls`
|
!insertmacro LYX_DEFFUNC `EnableBrowseControls`
|
||||||
|
!insertmacro LYX_DEFFUNC `SearchRegistry`
|
||||||
!insertmacro LYX_DEFFUNC `DownloadEnter`
|
!insertmacro LYX_DEFFUNC `DownloadEnter`
|
||||||
!insertmacro LYX_DEFFUNC `DownloadLeave`
|
!insertmacro LYX_DEFFUNC `DownloadLeave`
|
||||||
|
|
||||||
@ -133,13 +134,65 @@
|
|||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
!macro DownloadEnter_Private ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath Required DownloadLabel HomeLabel PageHeader PageDescription
|
!macro SearchRegistry_Private ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath
|
||||||
!define skipBackupLbl "skipBackup_${__LINE__}"
|
|
||||||
|
|
||||||
${if} ${ExePath} == ""
|
${if} ${ExePath} == ""
|
||||||
ReadRegStr ${ExePath} HKLM "${RegistryKey}" "${RegistrySubKey}"
|
ReadRegStr ${ExePath} HKLM "${RegistryKey}" "${RegistrySubKey}"
|
||||||
|
${if} ${ExePath} != ""
|
||||||
|
${StrRep} "${ExePath}" "${ExePath}" "${RemoveFromPath}" ""
|
||||||
|
StrCpy ${ExePath} "${ExePath}${AddtoPath}"
|
||||||
|
${endif}
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!macro LYX_FUNCTION_SearchRegistry
|
||||||
|
!insertmacro LYX_FUNC `SearchRegistry`
|
||||||
|
|
||||||
|
; The stack contains:
|
||||||
|
; TOP
|
||||||
|
; ExePath
|
||||||
|
; RegistryKey
|
||||||
|
; RegistrySubKey
|
||||||
|
; RemoveFromPath
|
||||||
|
; AddtoPath
|
||||||
|
|
||||||
|
; After this point:
|
||||||
|
; $0 = ExePath
|
||||||
|
; $1 = RegistryKey
|
||||||
|
; $2 = RegistrySubKey
|
||||||
|
; $3 = RemoveFromPath
|
||||||
|
; $4 = AddtoPath
|
||||||
|
|
||||||
|
Exch $0
|
||||||
|
Exch
|
||||||
|
Exch $1
|
||||||
|
Exch 2
|
||||||
|
Exch $2
|
||||||
|
Exch 3
|
||||||
|
Exch $3
|
||||||
|
Exch 4
|
||||||
|
Exch $4
|
||||||
|
|
||||||
|
; Use a macro simply to make life understandable.
|
||||||
|
!insertmacro SearchRegistry_Private "$0" "$1" "$2" "$3" "$4"
|
||||||
|
|
||||||
|
; Return output to user.
|
||||||
|
Exch $4
|
||||||
|
Exch 4
|
||||||
|
Exch $3
|
||||||
|
Exch 3
|
||||||
|
Exch $2
|
||||||
|
Exch 2
|
||||||
|
Exch $1
|
||||||
|
Exch
|
||||||
|
Exch $0
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!macro DownloadEnter_Private ExePath Required DownloadLabel HomeLabel PageHeader PageDescription
|
||||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 1" "Text" ""
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 1" "Text" ""
|
||||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 2" "Text" "$(DownloadPageField2)"
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 2" "Text" "$(DownloadPageField2)"
|
||||||
|
|
||||||
@ -167,8 +220,6 @@
|
|||||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 4" "State" "1"
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 4" "State" "1"
|
||||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 5" "Flags" PATH_MUST_EXIST
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 5" "Flags" PATH_MUST_EXIST
|
||||||
|
|
||||||
${StrRep} "${ExePath}" "${ExePath}" "${RemoveFromPath}" ""
|
|
||||||
StrCpy ${ExePath} "${ExePath}${AddtoPath}"
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 5" "State" "${ExePath}"
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 5" "State" "${ExePath}"
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
@ -176,7 +227,6 @@
|
|||||||
|
|
||||||
!insertmacro MUI_HEADER_TEXT "${PageHeader}" "${PageDescription}"
|
!insertmacro MUI_HEADER_TEXT "${PageHeader}" "${PageDescription}"
|
||||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioDownload.ini"
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioDownload.ini"
|
||||||
!undef skipBackupLbl
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
@ -186,10 +236,6 @@
|
|||||||
; The stack contains:
|
; The stack contains:
|
||||||
; TOP
|
; TOP
|
||||||
; ExePath
|
; ExePath
|
||||||
; RegistryKey
|
|
||||||
; RegistrySubKey
|
|
||||||
; RemoveFromPath
|
|
||||||
; AddtoPath
|
|
||||||
; Required
|
; Required
|
||||||
; DownloadLabel
|
; DownloadLabel
|
||||||
; HomeLabel
|
; HomeLabel
|
||||||
@ -198,15 +244,11 @@
|
|||||||
|
|
||||||
; After this point:
|
; After this point:
|
||||||
; $0 = ExePath
|
; $0 = ExePath
|
||||||
; $1 = RegistryKey
|
; $1 = Required
|
||||||
; $2 = RegistrySubKey
|
; $2 = DownloadLabel
|
||||||
; $3 = RemoveFromPath
|
; $3 = HomeLabel
|
||||||
; $4 = AddtoPath
|
; $4 = PageHeader
|
||||||
; $5 = Required
|
; $5 = PageDescription
|
||||||
; $6 = DownloadLabel
|
|
||||||
; $7 = HomeLabel
|
|
||||||
; $8 = PageHeader
|
|
||||||
; $9 = PageDescription
|
|
||||||
|
|
||||||
Exch $0
|
Exch $0
|
||||||
Exch
|
Exch
|
||||||
@ -219,27 +261,11 @@
|
|||||||
Exch $4
|
Exch $4
|
||||||
Exch 5
|
Exch 5
|
||||||
Exch $5
|
Exch $5
|
||||||
Exch 6
|
|
||||||
Exch $6
|
|
||||||
Exch 7
|
|
||||||
Exch $7
|
|
||||||
Exch 8
|
|
||||||
Exch $8
|
|
||||||
Exch 9
|
|
||||||
Exch $9
|
|
||||||
|
|
||||||
; Use a macro simply to make life understandable.
|
; Use a macro simply to make life understandable.
|
||||||
!insertmacro DownloadEnter_Private "$0" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
!insertmacro DownloadEnter_Private "$0" "$1" "$2" "$3" "$4" "$5"
|
||||||
|
|
||||||
; Return output to user.
|
; Return output to user.
|
||||||
Exch $9
|
|
||||||
Exch 9
|
|
||||||
Exch $8
|
|
||||||
Exch 8
|
|
||||||
Exch $7
|
|
||||||
Exch 7
|
|
||||||
Exch $6
|
|
||||||
Exch 6
|
|
||||||
Exch $5
|
Exch $5
|
||||||
Exch 5
|
Exch 5
|
||||||
Exch $4
|
Exch $4
|
||||||
@ -256,7 +282,6 @@
|
|||||||
|
|
||||||
|
|
||||||
!macro DownloadLeave_Private DoNotRequire Download FolderPath URL EnterFolder ExeName InvalidFolder
|
!macro DownloadLeave_Private DoNotRequire Download FolderPath URL EnterFolder ExeName InvalidFolder
|
||||||
!define skipBackupLbl "skipBackup_${__LINE__}"
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_READ $0 "ioDownload.ini" "Settings" "State"
|
!insertmacro MUI_INSTALLOPTIONS_READ $0 "ioDownload.ini" "Settings" "State"
|
||||||
|
|
||||||
StrCmp $0 0 go_on ; Next button?
|
StrCmp $0 0 go_on ; Next button?
|
||||||
@ -293,7 +318,6 @@ go_on:
|
|||||||
Abort
|
Abort
|
||||||
${endif}
|
${endif}
|
||||||
${endif}
|
${endif}
|
||||||
!undef skipBackupLbl
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
@ -372,17 +396,32 @@ go_on:
|
|||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
!macro LYX_FUNCTION_DownloadEnter_Call ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath Required DownloadLabel HomeLabel PageHeader PageDescription
|
!macro LYX_FUNCTION_SearchRegistry_Call ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath
|
||||||
Push `${PageDescription}`
|
|
||||||
Push `${PageHeader}`
|
|
||||||
Push `${HomeLabel}`
|
|
||||||
Push `${DownloadLabel}`
|
|
||||||
Push `${Required}`
|
|
||||||
Push `${AddtoPath}`
|
Push `${AddtoPath}`
|
||||||
Push `${RemoveFromPath}`
|
Push `${RemoveFromPath}`
|
||||||
Push `${RegistrySubKey}`
|
Push `${RegistrySubKey}`
|
||||||
Push `${RegistryKey}`
|
Push `${RegistryKey}`
|
||||||
Push `${ExePath}`
|
Push `${ExePath}`
|
||||||
|
|
||||||
|
Call SearchRegistry
|
||||||
|
; Empty the stack of all the stuff we've just added.
|
||||||
|
; We're not interested in most of it, so just fill $0 repeatedly.
|
||||||
|
|
||||||
|
Pop `${ExePath}`
|
||||||
|
Pop `$0`
|
||||||
|
Pop `$0`
|
||||||
|
Pop `$0`
|
||||||
|
Pop `$0`
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!macro LYX_FUNCTION_DownloadEnter_Call ExePath Required DownloadLabel HomeLabel PageHeader PageDescription
|
||||||
|
Push `${PageDescription}`
|
||||||
|
Push `${PageHeader}`
|
||||||
|
Push `${HomeLabel}`
|
||||||
|
Push `${DownloadLabel}`
|
||||||
|
Push `${Required}`
|
||||||
|
Push `${ExePath}`
|
||||||
Call DownloadEnter
|
Call DownloadEnter
|
||||||
; Empty the stack of all the stuff we've just added.
|
; Empty the stack of all the stuff we've just added.
|
||||||
; We're not interested in keeping it, so just fill $0 repeatedly.
|
; We're not interested in keeping it, so just fill $0 repeatedly.
|
||||||
@ -392,10 +431,6 @@ go_on:
|
|||||||
Pop `$0`
|
Pop `$0`
|
||||||
Pop `$0`
|
Pop `$0`
|
||||||
Pop `$0`
|
Pop `$0`
|
||||||
Pop `$0`
|
|
||||||
Pop `$0`
|
|
||||||
Pop `$0`
|
|
||||||
Pop `$0`
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ ${StrRep}
|
|||||||
${StrTrim}
|
${StrTrim}
|
||||||
${ReadDownloadValues}
|
${ReadDownloadValues}
|
||||||
${EnableBrowseControls}
|
${EnableBrowseControls}
|
||||||
|
${SearchRegistry}
|
||||||
${DownloadEnter}
|
${DownloadEnter}
|
||||||
${DownloadLeave}
|
${DownloadLeave}
|
||||||
|
|
||||||
@ -306,21 +307,19 @@ Function .onInit
|
|||||||
!undef READ_ONLY
|
!undef READ_ONLY
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
StrCpy $MinSYSPath ""
|
Call SearchMinSYS
|
||||||
StrCpy $PythonPath ""
|
Call SearchPython
|
||||||
StrCpy $MiKTeXPath ""
|
Call SearchMiKTeX
|
||||||
StrCpy $PerlPath ""
|
Call SearchPerl
|
||||||
StrCpy $GhostscriptPath ""
|
Call SearchGhostscript
|
||||||
StrCpy $ImageMagickPath ""
|
Call SearchImageMagick
|
||||||
|
|
||||||
ClearErrors
|
ClearErrors
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
Function DownloadMinSYS
|
Function SearchMinSYS
|
||||||
StrCpy $DownloadMinSYS "0"
|
|
||||||
|
|
||||||
; Search the registry for the MinSYS uninstaller.
|
; Search the registry for the MinSYS uninstaller.
|
||||||
; If successful, put its location in $2.
|
; If successful, put its location in $2.
|
||||||
StrCpy $3 "Software\Microsoft\Windows\CurrentVersion\Uninstall"
|
StrCpy $3 "Software\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||||
@ -343,9 +342,19 @@ Function DownloadMinSYS
|
|||||||
Goto loop
|
Goto loop
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
${SearchRegistry} \
|
||||||
|
$MinSYSPath \
|
||||||
|
"$2" \
|
||||||
|
"Inno Setup: App Path" \
|
||||||
|
"" \
|
||||||
|
"\bin"
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function DownloadMinSYS
|
||||||
|
StrCpy $DownloadMinSYS "0"
|
||||||
|
|
||||||
${DownloadEnter} \
|
${DownloadEnter} \
|
||||||
$MinSYSPath "$2" "Inno Setup: App Path" \
|
$MinSYSPath \
|
||||||
"" "\bin" \
|
|
||||||
0 \
|
0 \
|
||||||
"$(MinSYSDownloadLabel)" \
|
"$(MinSYSDownloadLabel)" \
|
||||||
"$(MinSYSFolderLabel)" \
|
"$(MinSYSFolderLabel)" \
|
||||||
@ -366,12 +375,20 @@ FunctionEnd
|
|||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
|
Function SearchPython
|
||||||
|
${SearchRegistry} \
|
||||||
|
$PythonPath \
|
||||||
|
"Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe" \
|
||||||
|
"" \
|
||||||
|
"\Python.exe" \
|
||||||
|
""
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function DownloadPython
|
Function DownloadPython
|
||||||
StrCpy $DownloadPython "0"
|
StrCpy $DownloadPython "0"
|
||||||
|
|
||||||
${DownloadEnter} \
|
${DownloadEnter} \
|
||||||
$PythonPath "Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe" "" \
|
$PythonPath \
|
||||||
"\Python.exe" "" \
|
|
||||||
0 \
|
0 \
|
||||||
"$(PythonDownloadLabel)" \
|
"$(PythonDownloadLabel)" \
|
||||||
"$(PythonFolderLabel)" \
|
"$(PythonFolderLabel)" \
|
||||||
@ -392,13 +409,21 @@ FunctionEnd
|
|||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
|
Function SearchMiKTeX
|
||||||
|
${SearchRegistry} \
|
||||||
|
$MiKTeXPath \
|
||||||
|
"Software\MiK\MiKTeX\CurrentVersion\MiKTeX" \
|
||||||
|
"Install Root" \
|
||||||
|
"" \
|
||||||
|
"\miktex\bin"
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function DownloadMiKTeX
|
Function DownloadMiKTeX
|
||||||
StrCpy $DoNotRequireMiKTeX "1"
|
StrCpy $DoNotRequireMiKTeX "1"
|
||||||
StrCpy $DownloadMiKTeX "0"
|
StrCpy $DownloadMiKTeX "0"
|
||||||
|
|
||||||
${DownloadEnter} \
|
${DownloadEnter} \
|
||||||
$MiKTeXPath "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root" \
|
$MiKTeXPath \
|
||||||
"" "\miktex\bin" \
|
|
||||||
1 \
|
1 \
|
||||||
"$(MiKTeXDownloadLabel)" \
|
"$(MiKTeXDownloadLabel)" \
|
||||||
"$(MiKTeXFolderLabel)" \
|
"$(MiKTeXFolderLabel)" \
|
||||||
@ -419,13 +444,21 @@ FunctionEnd
|
|||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
|
Function SearchPerl
|
||||||
|
${SearchRegistry} \
|
||||||
|
$PerlPath \
|
||||||
|
"Software\Perl" \
|
||||||
|
BinDir \
|
||||||
|
"\perl.exe" \
|
||||||
|
""
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function DownloadPerl
|
Function DownloadPerl
|
||||||
StrCpy $DoNotRequirePerl "1"
|
StrCpy $DoNotRequirePerl "1"
|
||||||
StrCpy $DownloadPerl "1"
|
StrCpy $DownloadPerl "1"
|
||||||
|
|
||||||
${DownloadEnter} \
|
${DownloadEnter} \
|
||||||
$PerlPath "Software\Perl" BinDir \
|
$PerlPath \
|
||||||
"\perl.exe" "" \
|
|
||||||
1 \
|
1 \
|
||||||
"$(PerlDownloadLabel)" \
|
"$(PerlDownloadLabel)" \
|
||||||
"$(PerlFolderLabel)" \
|
"$(PerlFolderLabel)" \
|
||||||
@ -446,6 +479,23 @@ FunctionEnd
|
|||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
|
Function SearchGhostscript
|
||||||
|
; Find which version of ghostscript, if any, is installed.
|
||||||
|
EnumRegKey $1 HKLM "Software\AFPL Ghostscript" 0
|
||||||
|
${if} $1 != ""
|
||||||
|
StrCpy $0 "Software\AFPL Ghostscript\$1"
|
||||||
|
${else}
|
||||||
|
StrCpy $0 ""
|
||||||
|
${endif}
|
||||||
|
|
||||||
|
${SearchRegistry} \
|
||||||
|
$GhostscriptPath \
|
||||||
|
"$0" \
|
||||||
|
"GS_DLL" \
|
||||||
|
"\gsdll32.dll" \
|
||||||
|
""
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function DownloadGhostscript
|
Function DownloadGhostscript
|
||||||
StrCpy $DoNotRequireGhostscript "1"
|
StrCpy $DoNotRequireGhostscript "1"
|
||||||
StrCpy $DownloadGhostscript "0"
|
StrCpy $DownloadGhostscript "0"
|
||||||
@ -459,8 +509,7 @@ Function DownloadGhostscript
|
|||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
${DownloadEnter} \
|
${DownloadEnter} \
|
||||||
$GhostscriptPath "$0" "GS_DLL" \
|
$GhostscriptPath \
|
||||||
"\gsdll32.dll" "" \
|
|
||||||
1 \
|
1 \
|
||||||
"$(GhostscriptDownloadLabel)" \
|
"$(GhostscriptDownloadLabel)" \
|
||||||
"$(GhostscriptFolderLabel)" \
|
"$(GhostscriptFolderLabel)" \
|
||||||
@ -481,13 +530,21 @@ FunctionEnd
|
|||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
|
Function SearchImageMagick
|
||||||
|
${SearchRegistry} \
|
||||||
|
$ImageMagickPath \
|
||||||
|
"Software\ImageMagick\Current" \
|
||||||
|
"BinPath" \
|
||||||
|
"" \
|
||||||
|
""
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function DownloadImageMagick
|
Function DownloadImageMagick
|
||||||
StrCpy $DoNotRequireImageMagick "1"
|
StrCpy $DoNotRequireImageMagick "1"
|
||||||
StrCpy $DownloadImageMagick "0"
|
StrCpy $DownloadImageMagick "0"
|
||||||
|
|
||||||
${DownloadEnter} \
|
${DownloadEnter} \
|
||||||
$ImageMagickPath "Software\ImageMagick\Current" "BinPath" \
|
$ImageMagickPath \
|
||||||
"" "" \
|
|
||||||
1 \
|
1 \
|
||||||
"$(ImageMagickDownloadLabel)" \
|
"$(ImageMagickDownloadLabel)" \
|
||||||
"$(ImageMagickFolderLabel)" \
|
"$(ImageMagickFolderLabel)" \
|
||||||
|
Loading…
Reference in New Issue
Block a user