lyx_mirror/development/Win32/packaging/installer/include/detection.nsh
Joost Verburg 308906651c remove old code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@34942 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-17 15:55:26 +00:00

114 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
#--------------------------------
# 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