lyx_mirror/development/Win32/packaging/installer/include/detection.nsh
Joost Verburg 5ca5dceac7 Windows installer updates:
* New versions of dependencies
* Improved MiKTeX detection
* Remove language selection during installation (this is now set in the LyX preferences)
* Remove hacks from LyXLauncher that are no longer needed with gettext 0.18
* Clean up some code that is no longer in use

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@34916 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-16 14:17:03 +00:00

116 lines
2.4 KiB
Plaintext

/*
detection.nsh
Detection of external component locations
*/
Function SearchExternal
Call SearchLaTeX
Call SearchBibTeXEditor
FunctionEnd
#--------------------------------
# MiKTeX
Var ReportReturn
Var CommandLineOutput
!macro SEARCH_MIKTEX25
# Search location of MiKTeX installation using initexmf
# Works for version 2.5 and later
nsExec::ExecToStack "initexmf.exe --report"
Pop $ReportReturn
Pop $CommandLineOutput
ClearErrors
${WordFind2X} $CommandLineOutput "BinDir: " "$\r" "E+1" $PathLaTeX
${If} ${Errors}
ClearErrors
${WordFind2X} $CommandLineOutput "CommonInstall: " "$\r" "E+1" $PathLaTeX
${If} ${Errors}
StrCpy $PathLaTeX ""
${Else}
StrCpy $PathLaTeX "$PathLaTeX\miktex\bin"
${EndIf}
${EndIf}
ClearErrors
${WordFind2X} $CommandLineOutput "BinDir: " "$\r" "E+1" $PathLaTeX
${If} ${Errors}
StrCpy $PathLaTeX ""
${EndIf}
${If} $PathLatex == ""
ClearErrors
${WordFind2X} $CommandLineOutput "CommonInstall: " "$\r" "E+1" $PathLaTeX
${If} ${Errors}
StrCpy $PathLaTeX ""
${Else}
StrCpy $PathLaTeX "$PathLaTeX\miktex\bin"
${EndIf}
${EndIf}
${If} $PathLatex == ""
ClearErrors
${WordFind2X} $CommandLineOutput "UserInstall: " "$\r" "E+1" $PathLaTeX
${If} ${Errors}
StrCpy $PathLaTeX ""
${Else}
StrCpy $PathLaTeX "$PathLaTeX\miktex\bin"
${EndIf}
${EndIf}
# Local root
ClearErrors
${WordFind2X} $CommandLineOutput "CommonData: " "$\r" "E+1" $PathLaTeXLocal
${If} ${Errors}
StrCpy $PathLaTeXLocal ""
${EndIf}
${If} $PathLatex == ""
ClearErrors
${WordFind2X} $CommandLineOutput "UserData: " "$\r" "E+1" $PathLaTeXLocal
${If} ${Errors}
StrCpy $PathLaTeXLocal ""
${EndIf}
${EndIf}
!macroend
Function SearchLaTeX
# Search where MikTeX is installed
!insertmacro SEARCH_MIKTEX25
${IfNot} ${FileExists} "$PathLaTeX\${BIN_LATEX}"
StrCpy $PathLateX ""
${EndIf}
FunctionEnd
!endif
#--------------------------------
# JabRef
Function SearchBibTeXEditor
# Search where JabRef is installed
ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
${IfNot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
ReadRegStr $PathBibTeXEditor HKLM "Software\JabRef" "Path"
${EndIf}
${IfNot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
StrCpy $PathBibTeXEditor ""
${EndIf}
FunctionEnd