Skip to content

Commit

Permalink
fix detection if FreeCAD.exe is currently running when installer is e…
Browse files Browse the repository at this point in the history
…xecuted
  • Loading branch information
donovaly committed Mar 31, 2019
1 parent 005af83 commit 31de2c8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
4 changes: 3 additions & 1 deletion FreeCAD-installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ManifestDPIAware true
!define MULTIUSER_INSTALLMODE_FUNCTION InitUser
!define MULTIUSER_MUI

# Standard header files
# included NSIS files
!include MUI2.nsh
!include LogicLib.nsh
!include Sections.nsh
Expand All @@ -42,6 +42,8 @@ ManifestDPIAware true
!include MultiUser.nsh
!include InstallOptions.nsh
!include x64.nsh
# load the nsPprocess plugin
!include nsProcess.nsh

# Set of various macros and functions
!include include\utils.nsh
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
A GitHub project to develop a Windos installer for FreeCAD

To build the installer do the following:
1. extract the source zip-file "FC-standard-installer.zip" to e.g. the path "C:\FreeCAD\Installer"
2. open the file Settings.nsh with a text editor
1. Extract the source zip-file "FC-standard-installer.zip" to e.g. the path "C:\FreeCAD\Installer"
2. Open the file Settings.nsh with a text editor
(the editor jEdit (jedit.org) can be recommended to edit NSIS files)
and adapt there the following paths to the ones on your PC, e.g.:</br>
!define FILES_FREECAD "C:\FreeCAD\Installer\FreeCAD"</br>
!define FILES_DEPS "C:\FreeCAD\Installer\MSVCRedist"
3. specify in Settings.nsh if it should be an installer for 32bit by commenting the line </br>
3. Specify in Settings.nsh if it should be an installer for 32bit by commenting the line </br>
!define MULTIUSER_USE_PROGRAMFILES64
4. install the latest version 3.x of NSIS (https://nsis.sourceforge.io/Download)
5. download the file FindProcDLL Unicode bin.zip from</br>
https://sourceforge.net/projects/findkillprocuni/files/bin/FindProcDLL%20Unicode%20bin.zip/download </br>
and extract it.</br>
Copy the extracted file FindProc.dll to the folder \Plugins\x86-unicode of
NSIS's installation folder.
6. copy all FreeCAD files to the folder "~\FreeCAD"
4. Install the latest version 3.x of NSIS (https://nsis.sourceforge.io/Download)
5. Copy the file ~\nsprocess\Include\nsProcess.nsh to the folder</br>
\Include of NSIS's installation folder.</br>
Copy the file ~\nsprocess\Plugins\x86-unicode\nsProcess.dll to the folder</br>
\Plugins\x86-unicode of NSIS's installation folder.
6. Copy all FreeCAD files to the folder "~\FreeCAD"
e.g. "C:\FreeCAD\Installer\FreeCAD"
7. right-click on the file FreeCAD-installer.nsi and choose "Compile NSIS script"
7. If you use compiled FreeCAD using another MSVC version than MSVC 2015, copy
its distributable DLLs to the folder FILES_DEPS (see step 2).
8. Right-click on the file FreeCAD-installer.nsi and choose "Compile NSIS script"
to compile the installer

For test builds of the installer you can turn off the compression. This speeds up
Expand Down
2 changes: 1 addition & 1 deletion Settings.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SetCompressor /SOLID lzma
!define APP_VERSION_REVISION 0
!define APP_VERSION_EMERGENCY "" # use "1" for an emergency release of FreeCAD otherwise ""
!define APP_EMERGENCY_DOT "" # use "." for an emergency release of FreeCAD otherwise ""
!define APP_VERSION_BUILD 8 # Start with 1 for the installer releases of each version
!define APP_VERSION_BUILD 9 # Start with 1 for the installer releases of each version

!define APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}" # Version to display

Expand Down
7 changes: 5 additions & 2 deletions include/init.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ Function .onInit
${endif}

# Check that FreeCAD is not currently running
FindProcDLL::FindProc "${BIN_FREECAD}"
${if} $R0 == "1"
${nsProcess::FindProcess} ${BIN_FREECAD} $R0
# if running result is '0', if not running it is '603'
${if} $R0 == "0"
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
Abort
${endif}
# plugin must be unloaded
${nsProcess::Unload}

# initialize the multi-uder installer UI
!insertmacro MULTIUSER_INIT
Expand Down

0 comments on commit 31de2c8

Please sign in to comment.