2007-02-08 21:09:30 +00:00
|
|
|
/*
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
detection.nsh
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Detection of external component locations
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
*/
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Function SearchExternal
|
2007-02-08 21:09:30 +00:00
|
|
|
Call SearchLaTeX
|
2008-05-02 15:53:14 +00:00
|
|
|
Call SearchBibTeXEditor
|
|
|
|
!ifndef BUNDLE_IMAGEMAGICK
|
|
|
|
Call SearchImageMagick
|
|
|
|
!endif
|
|
|
|
!ifndef BUNDLE_GHOSTSCRIPT
|
|
|
|
Call SearchGhostscript
|
|
|
|
!endif
|
2007-02-08 21:09:30 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
#--------------------------------
|
|
|
|
# MiKTeX
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-31 15:31:09 +00:00
|
|
|
Var ReportReturn
|
2008-03-30 21:37:53 +00:00
|
|
|
Var CommandLineOutput
|
|
|
|
Var LastChar
|
|
|
|
Var PathLength
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!macro SEARCH_MIKTEX25
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Search location of MiKTeX installation using initexmf
|
|
|
|
# Works for version 2.5 and later
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
nsExec::ExecToStack "initexmf.exe --report"
|
2008-03-31 15:31:09 +00:00
|
|
|
Pop $ReportReturn
|
2008-03-30 21:37:53 +00:00
|
|
|
Pop $CommandLineOutput
|
2008-03-31 15:31:09 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${WordFind2X} $CommandLineOutput "BinDir: " "$\r" "+1" $PathLaTeX
|
2008-03-31 15:31:09 +00:00
|
|
|
${WordFind2X} $CommandLineOutput "CommonData: " "$\r" "+1" $PathLaTeXLocal # Local root
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!macroend
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!macro SEARCH_MIKTEX24 ROOTKEY
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
ReadRegStr $PathLaTeX ${ROOTKEY} "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $PathLaTeX != ""
|
2008-03-31 15:31:09 +00:00
|
|
|
StrCpy $LastChar $PathLaTeX 1 -1
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $LastChar == "\"
|
|
|
|
# Trim backslash
|
|
|
|
StrLen $PathLength $PathLaTeX
|
|
|
|
IntOp $PathLength $PathLength - 1
|
|
|
|
StrCpy $PathLaTeX $PathLaTeX $PathLength
|
|
|
|
${EndIf}
|
2008-03-31 15:31:09 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
StrCpy $PathLaTeX "$PathLaTeX\miktex\bin"
|
2008-03-31 15:31:09 +00:00
|
|
|
|
|
|
|
#Local root
|
|
|
|
ReadRegStr $PathLaTeXLocal ${ROOTKEY} "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Local Root"
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2008-03-31 15:31:09 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!macroend
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function SearchLaTeX
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Search where MikTeX is installed
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro SEARCH_MIKTEX25
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${FileExists} "$PathLaTeX\${BIN_LATEX}"
|
|
|
|
!insertmacro SEARCH_MIKTEX24 HKCU
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${FileExists} "$PathLaTeX\${BIN_LATEX}"
|
|
|
|
!insertmacro SEARCH_MIKTEX24 HKLM
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${FileExists} "$PathLaTeX\${BIN_LATEX}"
|
2008-03-31 15:31:09 +00:00
|
|
|
StrCpy $PathLateX ""
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
#--------------------------------
|
|
|
|
# Ghostscript
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-05-02 15:53:14 +00:00
|
|
|
!ifndef BUNDLE_GHOSTSCRIPT
|
|
|
|
|
|
|
|
!insertmacro GetParent
|
|
|
|
!insertmacro VersionCompare
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Var Counter
|
|
|
|
Var EnumReturn
|
|
|
|
Var CompareReturn
|
|
|
|
Var AFPLVersion
|
|
|
|
Var GPLVersion
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function SearchGhostscript
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Search where Ghostscript is installed
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Find the latest version of AFPL Ghostscript installed
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
StrCpy $Counter 0
|
|
|
|
|
2007-02-08 21:09:30 +00:00
|
|
|
${do}
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
EnumRegKey $EnumReturn HKLM "Software\AFPL Ghostscript" $Counter
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $EnumReturn != ""
|
|
|
|
${VersionCompare} $EnumReturn $AFPLVersion $CompareReturn
|
|
|
|
${If} $CompareReturn == "1"
|
|
|
|
StrCpy $AFPLVersion $EnumReturn
|
|
|
|
${EndIf}
|
|
|
|
IntOp $Counter $Counter + 1
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${loopuntil} $EnumReturn == ""
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# The same for GPL Ghostscript
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
StrCpy $Counter 0
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
${do}
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
EnumRegKey $EnumReturn HKLM "Software\GPL Ghostscript" $Counter
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $EnumReturn != ""
|
|
|
|
${VersionCompare} $EnumReturn $GPLVersion $CompareReturn
|
|
|
|
${If} $CompareReturn == "1"
|
|
|
|
StrCpy $GPLVersion $EnumReturn
|
|
|
|
${EndIf}
|
|
|
|
IntOp $Counter $Counter + 1
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${loopuntil} $EnumReturn == ""
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Take the latest one
|
|
|
|
${VersionCompare} $AFPLVersion $GPLVersion $CompareReturn
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $CompareReturn = 1
|
|
|
|
# AFPL is newer
|
2007-02-08 21:09:30 +00:00
|
|
|
ReadRegStr $PathGhostscript HKLM "Software\AFPL Ghostscript\$R3" "GS_DLL"
|
2008-03-30 21:37:53 +00:00
|
|
|
${Else}
|
|
|
|
# GPL is newer or equal
|
2007-02-08 21:09:30 +00:00
|
|
|
ReadRegStr $PathGhostscript HKLM "Software\GPL Ghostscript\$R4" "GS_DLL"
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Trim the DLL filename to get the path
|
2007-02-08 21:09:30 +00:00
|
|
|
${GetParent} $PathGhostscript $PathGhostscript
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${FileExists} "$PathGhostscript\${BIN_GHOSTSCRIPT}"
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $PathGhostscript ""
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2008-05-02 15:53:14 +00:00
|
|
|
!endif
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
#--------------------------------
|
|
|
|
# ImageMagick
|
|
|
|
|
2008-05-02 15:53:14 +00:00
|
|
|
!ifndef BUNDLE_IMAGEMAGICK
|
|
|
|
|
2007-02-08 21:09:30 +00:00
|
|
|
Function SearchImageMagick
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Search where ImageMagick is installed
|
2007-02-08 21:09:30 +00:00
|
|
|
ReadRegStr $PathImageMagick HKLM "Software\ImageMagick\Current" "BinPath"
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${FileExists} "$PathImageMagick\${BIN_IMAGEMAGICK}"
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $PathImageMagick ""
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
FunctionEnd
|
2008-05-02 15:53:14 +00:00
|
|
|
|
|
|
|
!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
|