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
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# This script contains the following functions:
|
|
|
|
#
|
|
|
|
# - SearchExternal, calls the functions:
|
|
|
|
# LaTeXActions
|
|
|
|
# MissingPrograms
|
2012-11-10 06:05:19 +00:00
|
|
|
# FindDictionaries
|
2011-05-23 04:12:10 +00:00
|
|
|
#
|
|
|
|
# - MissingPrograms, (check if third-party programs are installed), uses:
|
|
|
|
# SEARCH_MIKTEX
|
|
|
|
# SEARCH_TEXLIVE
|
|
|
|
#
|
2012-11-10 06:05:19 +00:00
|
|
|
# - FindDictionaries (finds installed spellcheck and thesaurus dictionaries)
|
|
|
|
#
|
2011-05-23 04:12:10 +00:00
|
|
|
# - EditorCheck,
|
|
|
|
# (test if an editor with syntax-highlighting for LaTeX-files is installed)
|
|
|
|
#
|
|
|
|
#--------------------------
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Function SearchExternal
|
2011-05-23 04:12:10 +00:00
|
|
|
Call LaTeXActions # function from LaTeX.nsh
|
|
|
|
Call MissingPrograms
|
2012-11-11 17:07:55 +00:00
|
|
|
Call FindDictionaries # function from dictionaries.nsh
|
2007-02-08 21:09:30 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# ---------------------------------------
|
|
|
|
|
|
|
|
Function MissingPrograms
|
|
|
|
# check if third-party programs are installed
|
|
|
|
|
2012-11-11 06:12:43 +00:00
|
|
|
# test if Ghostscript is installed, check all cases:
|
2012-11-10 21:08:43 +00:00
|
|
|
# 1. 32bit Windows
|
|
|
|
# 2. 64bit Windows but 32bit Ghostscript
|
|
|
|
# 3. 64bit Windows and 64bit Ghostscript
|
2011-09-05 06:09:13 +00:00
|
|
|
StrCpy $3 0
|
2012-11-10 21:08:43 +00:00
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 64
|
|
|
|
${endif}
|
|
|
|
# case 1. and 3.
|
2011-05-23 04:12:10 +00:00
|
|
|
GSloop:
|
2011-09-05 06:09:13 +00:00
|
|
|
EnumRegKey $1 HKLM "Software\GPL Ghostscript" $3
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $1 != ""
|
2012-02-29 22:40:03 +00:00
|
|
|
ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
|
|
|
|
StrCpy $0 "Software\GPL Ghostscript\$1"
|
2011-09-05 06:09:13 +00:00
|
|
|
${if} $2 == "" # if nothing was found in the uninstall section
|
|
|
|
ReadRegStr $2 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
2011-09-05 06:09:13 +00:00
|
|
|
${if} $2 == "" # if nothing was found in the uninstall section
|
2011-05-23 04:12:10 +00:00
|
|
|
DeleteRegKey HKLM "$0"
|
|
|
|
goto GSloop
|
|
|
|
${else}
|
|
|
|
ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
|
|
|
|
${if} $GhostscriptPath != ""
|
|
|
|
StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
|
|
|
|
${endif}
|
2011-09-05 06:09:13 +00:00
|
|
|
# there might be several versions installed and we want to use the newest one
|
|
|
|
IntOp $3 $3 + 1
|
|
|
|
goto GSloop
|
|
|
|
${endif} # if $2
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
2012-11-10 21:08:43 +00:00
|
|
|
SetRegView 32
|
|
|
|
# repeat for case 2.
|
|
|
|
${if} ${RunningX64}
|
|
|
|
${andif} $GhostscriptPath == ""
|
|
|
|
StrCpy $3 0
|
2012-11-15 00:24:52 +00:00
|
|
|
# we have to assure that we only repeat once and not forever
|
|
|
|
${if} $4 != "32"
|
|
|
|
StrCpy $4 "32"
|
|
|
|
goto GSloop
|
|
|
|
${endif}
|
2012-11-10 21:08:43 +00:00
|
|
|
${endif}
|
2011-05-23 04:12:10 +00:00
|
|
|
|
|
|
|
# test if Python is installed
|
|
|
|
# only use an existing python when it is version 2.5 or newer because some
|
|
|
|
# older Compaq and Dell PCs were delivered with outdated Python interpreters
|
|
|
|
# Python 3.x was reported not to work with LyX properly, see
|
|
|
|
# http://www.lyx.org/trac/ticket/7143
|
|
|
|
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
|
|
|
|
${if} $PythonPath == ""
|
|
|
|
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.6\InstallPath" ""
|
|
|
|
${endif}
|
|
|
|
${if} $PythonPath == ""
|
|
|
|
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.7\InstallPath" ""
|
|
|
|
${endif}
|
|
|
|
${if} $PythonPath != ""
|
|
|
|
StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
|
|
|
|
StrCpy $DelPythonFiles "True"
|
|
|
|
${endif}
|
2011-07-25 03:09:02 +00:00
|
|
|
|
2012-11-20 20:53:35 +00:00
|
|
|
# No test necessary for Acrobat or Adobe Reader because pdfview does this job
|
|
|
|
# each time it is called.
|
|
|
|
|
2012-11-10 21:08:43 +00:00
|
|
|
# test if a PostScript-viewer is installed, only check for GSview
|
|
|
|
# check all cases:
|
|
|
|
# 1. 32bit Windows
|
|
|
|
# 2. 64bit Windows but 32bit GSview
|
|
|
|
# 3. 64bit Windows and 64bit GSview
|
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 64
|
|
|
|
StrCpy $PSVPath ""
|
|
|
|
ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview64.exe" "Path"
|
|
|
|
SetRegView 32
|
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
# repeat for case 1. and 2.
|
2012-11-10 21:08:43 +00:00
|
|
|
${if} $PSVPath == ""
|
|
|
|
ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
|
|
|
|
${endif}
|
2011-05-23 04:12:10 +00:00
|
|
|
|
|
|
|
# test if an editor with syntax-highlighting for LaTeX-files is installed
|
|
|
|
Call EditorCheck
|
|
|
|
|
2011-08-12 15:19:36 +00:00
|
|
|
# test if an image editor is installed
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $ImageEditorPath ""
|
2012-11-10 21:08:43 +00:00
|
|
|
# first check for Gimp which is a 64bit application on x64 Windows
|
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 64
|
|
|
|
${endif}
|
|
|
|
ReadRegStr $ImageEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GIMP-2_is1" "InstallLocation"
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $ImageEditorPath != ""
|
2012-11-10 21:08:43 +00:00
|
|
|
StrCpy $ImageEditorPath "$ImageEditorPathbin" # add the bin folder
|
|
|
|
${endif}
|
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 32
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
|
|
|
# check for Photoshop
|
2012-11-10 06:05:19 +00:00
|
|
|
ReadRegStr $0 HKLM "Software\Classes\Applications\Photoshop.exe\shell\open\command" ""
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $0 != ""
|
2012-11-10 06:05:19 +00:00
|
|
|
StrCpy $0 "$0" -20 # delete '\photoshop.exe" "%1"'
|
|
|
|
StrCpy $0 $0 "" 1 # remove the leading quote
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $ImageEditorPath != ""
|
|
|
|
StrCpy $ImageEditorPath "$ImageEditorPath;$0"
|
|
|
|
${else}
|
|
|
|
StrCpy $ImageEditorPath $0
|
|
|
|
${endif}
|
|
|
|
${endif}
|
2012-11-10 06:05:19 +00:00
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# test if and where the BibTeX-editor JabRef is installed
|
|
|
|
ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
|
|
|
|
${if} $PathBibTeXEditor == ""
|
|
|
|
ReadRegStr $PathBibTeXEditor HKLM "Software\JabRef" "Path"
|
|
|
|
${endif}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2012-11-22 19:17:45 +00:00
|
|
|
${ifnot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
|
|
|
|
StrCpy $PathBibTeXEditor ""
|
|
|
|
StrCpy $JabRefInstalled == "No"
|
2011-05-23 04:12:10 +00:00
|
|
|
${else}
|
|
|
|
StrCpy $JabRefInstalled == "Yes"
|
|
|
|
${endif}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2011-08-12 23:00:43 +00:00
|
|
|
# test if and where LilyPond is installed
|
2011-08-12 15:19:36 +00:00
|
|
|
ReadRegStr $LilyPondPath HKLM "Software\LilyPond" "Install_Dir"
|
|
|
|
${if} $LilyPondPath != ""
|
|
|
|
StrCpy $LilyPondPath "$LilyPondPath\usr\bin" # add "\usr\bin"
|
|
|
|
${endif}
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# test if Inkscape is installed
|
|
|
|
ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2011-12-14 00:14:30 +00:00
|
|
|
# test if Gnumeric is installed
|
|
|
|
ReadRegStr $0 HKLM "Software\Classes\Applications\gnumeric.exe\shell\Open\command" ""
|
|
|
|
${if} $0 != ""
|
|
|
|
StrCpy $0 $0 -18 # remove "gnumeric.exe" "%1""
|
2012-01-30 21:13:00 +00:00
|
|
|
StrCpy $0 $0 "" 1 # remove the leading quote
|
2011-12-14 00:14:30 +00:00
|
|
|
StrCpy $GnumericPath $0
|
|
|
|
${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
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# ---------------------------------------
|
|
|
|
|
|
|
|
Function EditorCheck
|
|
|
|
# test if an editor with syntax-highlighting for LaTeX-files is installed
|
|
|
|
|
|
|
|
# (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
|
|
|
|
StrCpy $EditorPath ""
|
|
|
|
StrCpy $0 ""
|
2012-11-10 21:08:43 +00:00
|
|
|
# check for jEdit which is a 64bit application on x64 Windows
|
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 64
|
|
|
|
${endif}
|
2011-05-23 04:12:10 +00:00
|
|
|
ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
|
|
|
|
${if} $EditorPath != ""
|
|
|
|
StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
|
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
SetRegView 32
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# check for PSPad
|
|
|
|
StrCpy $0 ""
|
|
|
|
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
|
|
|
|
${if} $0 != ""
|
2012-11-11 06:12:43 +00:00
|
|
|
StrCpy $0 $0 -1 # remove the "\"
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $EditorPath "$EditorPath;$0"
|
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# check for WinShell
|
|
|
|
StrCpy $0 ""
|
|
|
|
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
|
|
|
|
${if} $0 != ""
|
2012-11-11 06:12:43 +00:00
|
|
|
StrCpy $0 $0 -1 # remove the "\"
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $EditorPath "$EditorPath;$0"
|
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
|
|
|
|
# check for Vim which is a 64bit application on x64 Windows
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $0 ""
|
2012-11-11 06:12:43 +00:00
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 64
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
ReadRegStr $0 HKLM "Software\Vim\Gvim" "path"
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $0 != ""
|
2012-11-11 06:12:43 +00:00
|
|
|
StrCpy $0 $0 -9 # remove "\gvim.exe"
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $EditorPath "$EditorPath;$0"
|
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
SetRegView 32
|
|
|
|
|
|
|
|
# check for TeXnicCenter which can be a 64bit application on x64 Windows
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $0 ""
|
2012-11-11 06:12:43 +00:00
|
|
|
${if} ${RunningX64}
|
|
|
|
SetRegView 64
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $0 != ""
|
2012-11-11 06:12:43 +00:00
|
|
|
StrCpy $0 $0 -1 # remove the "\"
|
2011-05-23 04:12:10 +00:00
|
|
|
StrCpy $EditorPath "$EditorPath;$0"
|
2012-11-11 06:12:43 +00:00
|
|
|
${else}
|
|
|
|
SetRegView 32
|
|
|
|
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
|
2012-11-14 22:27:49 +00:00
|
|
|
${if} $0 != ""
|
|
|
|
StrCpy $0 $0 -1 # remove the "\"
|
|
|
|
StrCpy $EditorPath "$EditorPath;$0"
|
|
|
|
${endif}
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
2012-11-11 06:12:43 +00:00
|
|
|
SetRegView 32
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# check for WinEdt
|
|
|
|
StrCpy $0 ""
|
2012-11-11 06:12:43 +00:00
|
|
|
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt 7" "InstallLocation"
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $0 != ""
|
2012-11-14 22:32:20 +00:00
|
|
|
StrCpy $EditorPath "$EditorPath;$0"
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
2008-05-02 15:53:14 +00:00
|
|
|
|
|
|
|
FunctionEnd
|