mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
WinInstaller2: Check if LyX is already running during installation
Patch by Eugene
This commit is contained in:
parent
b3a90037b1
commit
b32c9ae8af
@ -13,9 +13,6 @@ To build the installer do the following:
|
||||
extract NSISList-Unicode\NSISList.dll from the second archive to the folder \Plugins\x86-unicode of NSIS's installation folder
|
||||
- download the plugin ShellLink (https://nsis.sourceforge.io/ShellLink_plug-in)
|
||||
extract Unicode\Plugins\ShellLink.dll from the archive to the folder \Plugins\x86-unicode of NSIS's installation folder
|
||||
- download the plugin nsProcess (https://nsis.sourceforge.io/NsProcess_plugin) with unicode support
|
||||
extract Plugin\nsProcessW.dll from the archive to the folder \Plugins\x86-unicode of NSIS's installation folder and rename it to nsProcess.dll
|
||||
extract Include\nsProcess.nsh from the archive to the folder \Include of NSIS's installation folder
|
||||
- Go to the Qt-kit directory, which you have specified as CMAKE_PREFIX_PATH before compiling in CMake Gui, enter the bin folder,
|
||||
copy these files:
|
||||
Qt5Concurrent.dll"
|
||||
|
@ -126,7 +126,7 @@
|
||||
|
||||
#!include LogicLib.nsh # included in MUI2 # Allows using logic commands (such as ${If}..${Else}..${EndIf})
|
||||
#!include LangFile.nsh # included in MUI2 # Header file to create language files that can be included with a single command.
|
||||
!include x64.nsh # Header file to check if target system is 64 bit or not with ${RunningX64}
|
||||
!include x64.nsh # Header file to check if target system is 64 bit or not with ${RunningX64}, also defines ${DisableX64FSRedirection} and ${EnableX64FSRedirection}
|
||||
!include NSISList.nsh # Header file to create and work with lists in NSIS (plugin)
|
||||
!include nsProcess.nsh # Header file to search for a running process (plugin)
|
||||
|
||||
@ -298,13 +298,6 @@ Function .onInit # Callback function, called at the very beginning, when user do
|
||||
Quit
|
||||
${endif}
|
||||
|
||||
# Check that LyX is not currently running
|
||||
${nsProcess::FindProcess} "LyX.exe" $R0
|
||||
${if} $R0 == "0"
|
||||
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
|
||||
Quit
|
||||
${endif}
|
||||
|
||||
Call PrepareShellCTX # MULTIUSER_INIT should search in the right registry view
|
||||
!insertmacro MULTIUSER_INIT # Verify multiuser privileges
|
||||
|
||||
@ -341,6 +334,23 @@ Function .onInit # Callback function, called at the very beginning, when user do
|
||||
${Loop}
|
||||
FunctionEnd
|
||||
|
||||
Function CheckIfRunning # Check that LyX in $INSTDIR is not currently running, called from Function VerifyInstDir and Section -CheckSilent (if silentinstall)
|
||||
${If} ${RunningX64}
|
||||
${DisableX64FSRedirection} # We need the following process to be 64 bit on 64 bit system
|
||||
${EndIf}
|
||||
nsExec::ExecToStack "powershell (Get-Process LyX).Path"
|
||||
Pop $0 # Exit code
|
||||
Pop $0 # Result string
|
||||
${If} ${RunningX64}
|
||||
${EnableX64FSRedirection} # Need to be anabled asap or installer might crash
|
||||
${EndIf}
|
||||
${StrStr} $0 $0 "$INSTDIR\bin\LyX.exe"
|
||||
${If} $0 != ""
|
||||
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
|
||||
Abort # Abort leaving the page (when called from the page callback) / Abort install (when called from the section)
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function VerifyInstDir # Custom Function, called when leaving directory page
|
||||
# if the $INSTDIR does not contain "LyX" we must add a subfolder to avoid that LyX will e.g.
|
||||
# be installed directly to "C:\Program Files" - the uninstaller will then delete the whole
|
||||
@ -351,6 +361,8 @@ Function VerifyInstDir # Custom Function, called when leaving directory page
|
||||
${NSD_SetText} $mui.DirectoryPage.Directory $INSTDIR # Refresh Textbox
|
||||
Abort # Abort leaving the page
|
||||
${EndIf}
|
||||
|
||||
Call CheckIfRunning
|
||||
FunctionEnd
|
||||
|
||||
Function RetrieveSMState # Custom function, called after the Startmenu page has been created
|
||||
@ -490,6 +502,8 @@ Section -CheckSilent # This section checks if it's a silent install and calls ne
|
||||
|
||||
# .onInit is called
|
||||
|
||||
Call CheckIfRunning
|
||||
|
||||
Call RetrieveSMState
|
||||
|
||||
Call FindLatex # Search for latex
|
||||
@ -990,11 +1004,20 @@ FunctionEnd
|
||||
|
||||
Function un.onInit # Callback function, called when the uninstaller initializes
|
||||
# Check that LyX is not currently running
|
||||
${nsProcess::FindProcess} "LyX.exe" $R0
|
||||
${If} $R0 == "0"
|
||||
${If} ${RunningX64}
|
||||
${DisableX64FSRedirection} # We need the following process to be 64 bit on 64 bit system
|
||||
${EndIf}
|
||||
nsExec::ExecToStack "powershell (Get-Process LyX).Path"
|
||||
Pop $0 # Exit code
|
||||
Pop $0 # Result string
|
||||
${If} ${RunningX64}
|
||||
${EnableX64FSRedirection} # Need to be anabled asap or installer might crash
|
||||
${EndIf}
|
||||
${UnStrStr} $0 $0 "$INSTDIR\bin\LyX.exe"
|
||||
${If} $0 != ""
|
||||
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
|
||||
Quit
|
||||
${endif}
|
||||
Quit # Quit uninstaller
|
||||
${EndIf}
|
||||
|
||||
Call un.PrepareShellCTX
|
||||
!insertmacro MULTIUSER_UNINIT
|
||||
|
Loading…
Reference in New Issue
Block a user