Var LatexPath # Used to store path to "latex.exe"
Var StartMenuFolder # Used to store the start menu folder
+ Var pathPrefix
# FIXME Variables needed due to "old" set of language strings, delete
Var LaTeXInstalled
Exch $9 # resultRegIdx
FunctionEnd
- !macro CreatePrepareShellCTXFun UnPrefix
- Function ${UnPrefix}PrepareShellCTX
- ${if} $MultiUser.InstallMode == "CurrentUser"
- SetShellVarContext current
- ${Else}
- SetShellVarContext all
- ${EndIf}
- !if ${APP_ARCHITECTURE} <> 32
- SetRegView ${APP_ARCHITECTURE}
- !endif
- FunctionEnd
+ !macro PrepareShellCTX
+ ${if} $MultiUser.InstallMode == "CurrentUser"
+ SetShellVarContext current
+ ${Else}
+ SetShellVarContext all
+ ${EndIf}
+ ${If} ${RunningX64}
+ SetRegView ${APP_ARCHITECTURE}
+ ${EndIf}
!macroend
-
- !insertmacro CreatePrepareShellCTXFun ""
- !insertmacro CreatePrepareShellCTXFun "un."
+
+ Function PrepareShellCTX
+ !insertmacro PrepareShellCTX
+ FunctionEnd
+
+ Function un.PrepareShellCTX
+ !insertmacro PrepareShellCTX
+ FunctionEnd
#-------------------------------------------------------------
# - - - - - - - - - - - - Sections - - - - - - - - - - - - - -
SectionEnd
Section -LyxrcDist
- FileOpen $R0 "$INSTDIR\Resources\lyxrc.dist" a
- FileSeek $R0 0 END
- # set some general things
- FileWrite $R0 '\screen_zoom 120$\r$\n'
- FileWrite $R0 '\path_prefix "$LatexPath;$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\imagemagick;$$LyXDir\ghostscript'
-
- # Do not overwrite $R0 in this Section!!!
- # =======================================
+ StrCpy $pathPrefix "$LatexPath;$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\imagemagick;$$LyXDir\ghostscript\bin"
# Find additional software and add their install locations to the path_prefix
# This list contains all software, which write the string value "InstallLocation" in their corresponding keys in "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
${If} $1 == "\" # If ends with "\"
StrCpy $0 $0 -1 # Remove "\"
${EndIf}
- FileWrite $R0 ";$0"
+ StrCpy $pathPrefix "$pathPrefix;$0"
${EndIf}
${Next}
${List.Destroy} editors
ReadRegStr $0 SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$0" "DisplayIcon"
${StrStrAdv} $0 $0 "\gvim.exe" ">" "<" "0" "0" "0" # get everything before "\gvim.exe"
${If} $0 != ""
- FileWrite $R0 ";$0"
+ StrCpy $pathPrefix "$pathPrefix;$0"
${EndIf}
# JabRef, Hard to locate, JabRef uses MSI installer, lets try to find it through the .bib extension
${StrRep} $0 $0 '"' "" # Remove quotes
${StrStrAdv} $0 $0 "\JabRef.exe" ">" "<" "0" "0" "0" # Get everything before "\JabRef.exe"
${If} ${FileExists} "$0\JabRef.exe"
- FileWrite $R0 ";$0"
+ StrCpy $pathPrefix "$pathPrefix;$0"
${Break}
${EndIf}
SetShellVarContext current # Retry as user
${StrRep} $0 $0 '"' "" # Remove quotes
${StrStrAdv} $0 $0 "\gnumeric.exe" ">" "<" "0" "0" "0" # Get everything before "\gnumeric.exe"
${If} $0 != ""
- FileWrite $R0 ";$0"
+ StrCpy $pathPrefix "$pathPrefix;$0"
${Break}
${EndIf}
SetShellVarContext current # Retry as user
${If} $1 = 0
${StrStrAdv} $0 $0 "\pandoc.exe" ">" "<" "0" "0" "0" # Get everything before "\pandoc.exe"
${If} $0 != ""
- FileWrite $R0 ";$0"
+ StrCpy $pathPrefix "$pathPrefix;$0"
${EndIf}
${EndIf}
${SearchAllRegistry} $0 $1 $1 "SOFTWARE" "LilyPond" 0 0 # Helper Function from above
ReadRegStr $0 SHCTX "SOFTWARE\$0" "Install_Dir"
${If} $0 != ""
- FileWrite $R0 ";$0\usr\bin"
+ StrCpy $pathPrefix "$pathPrefix;$0\usr\bin"
${Map.Set} softwarePathsMap "LilyPond" "$0\usr\bin"
${EndIf}
${SearchAllRegistry} $2 $1 $1 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" "GIMP" 0 0 # Helper Function from above
ReadRegStr $0 SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$2" "InstallLocation"
${If} $0 != ""
- FileWrite $R0 ";$0bin" # Install Location ends with '\' for Gimp in Registry
+ StrCpy $pathPrefix "$pathPrefix;$0bin" # Install Location ends with '\' for Gimp in Registry
ReadRegStr $0 SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$2" "DisplayIcon"
${StrStrAdv} $0 $0 ".exe" ">" "<" "0" "0" "0" # Get everything before the ".exe"
${StrStrAdv} $0 $0 "\" "<" ">" "0" "0" "0" # Get everything after the last "\", $0 contains "gimp-10" now
${SearchAllRegistry} $0 $1 $1 "SOFTWARE" "Krita" 0 0 # Helper Function from above
ReadRegStr $0 SHCTX "SOFTWARE\$0" "InstallLocation"
${If} $0 != ""
- FileWrite $R0 ";$0\bin"
+ StrCpy $pathPrefix "$pathPrefix;$0\bin"
${Map.Set} softwarePathsMap "ImageEditor" "krita"
${EndIf}
${StrRep} $0 $0 '"' "" # Remove quotes
${StrStrAdv} $0 $0 "\photoshop.exe" ">" "<" "0" "0" "0" # Get everything before "\photoshop.exe"
${If} $0 != ""
- FileWrite $R0 ";$0"
+ StrCpy $pathPrefix "$pathPrefix;$0"
${Break}
${EndIf}
SetShellVarContext current # Retry as user
${Next}
- FileWrite $R0 '"$\r$\n'
-
ClearErrors
+
+ FileOpen $R0 "$INSTDIR\Resources\lyxrc.dist" a
+ FileSeek $R0 0 END
+ # set some general things
+ FileWrite $R0 '\screen_zoom 120$\r$\n'
+
+ FileWrite $R0 '\path_prefix "$pathPrefix"$\r$\n'
# use pdfview for all types of PDF files
FileWrite $R0 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
WriteRegStr SHCTX "Software\Classes\.lyx" "Content Type" "application/lyx"
WriteRegStr SHCTX "Software\Classes\LyX.Document" "" "LyX Document"
- WriteRegStr SHCTX "Software\Classes\LyX.Document\DefaultIcon" "" "$INSTDIR\bin\LyX.exe,0"
+ WriteRegStr SHCTX "Software\Classes\LyX.Document\DefaultIcon" "" "$INSTDIR\bin\LyX.exe,1"
WriteRegStr SHCTX "Software\Classes\LyX.Document\Shell\open\command" "" '"$INSTDIR\bin\LyX.exe" "%1"'
# we need to update also the automatically created entry about the lyx.exe
${EndIf}
StrCpy $LaTeXInstalled $R9 # FIXME remove
DetailPrint $(TEXT_CONFIGURE_LYX) # Uses R9 to display the name of the installed latex distribution
+
+ # Manipulate PATH environment of the running installer process, so that configure.py can find all the stuff needed
+ ReadEnvStr $0 "PATH"
+ ${StrRep} $pathPrefix $pathPrefix "$$LyXDir" "$INSTDIR"
+ System::Call 'Kernel32::SetEnvironmentVariable(t "PATH", t "$pathPrefix;$0")'
+
+ Call PrepareShellCTX
+ SetShellVarContext current # Otherwise $APPDATA would return C:\ProgrammData instead of C:\Users\username\AppData\Roaming
+ SetOutPath "$APPDATA\LyX${VERSION_MAJOR}.${VERSION_MINOR}" # Need to run configure from the user dir, because it creates .lst files and some folders.
nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
Pop $0 # Return value
SectionEnd
Function DefaultDesktopFileAssoc # Custom function, called before the components page, reads the states of SecDesktop and SecFileAssoc from registry (if overinstalling) and sets them
+
+ Call CheckDictionaries # Search for already installed dictionaries, in dictionaries.nsh
+
${IfNot} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
Return # Not over-installing
${EndIf}
${If} $0 == ""
SectionSetFlags ${SecDesktop} 0 # 0 means unselected
${EndIf}
-
- Call CheckDictionaries # Also search for already installed dictionaries, in dictionaries.nsh
FunctionEnd
Function StartLyX
- Exec "$INSTDIR\bin\LyX.exe"
+ ShellExecAsUser::ShellExecAsUser "" "$INSTDIR\bin\LyX.exe"
FunctionEnd
# Installer Section Descriptions
Pop $0 # Exit code
Pop $0 # Result string
${If} ${RunningX64}
- ${EnableX64FSRedirection} # Need to be anabled asap or installer might crash
+ ${EnableX64FSRedirection} # Need to be enabled asap or installer might crash
${EndIf}
${UnStrStr} $0 $0 "$INSTDIR\bin\LyX.exe"
${If} $0 != ""