From 5fb907768fb3bfbd095564146b19a3a8492b91ec Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 20 Dec 2010 14:23:17 +0000
Subject: Refuse to run the uninstaller while Swift is still running

Resolves: #686

diff --git a/Swift/Packaging/nsis/swift.nsi b/Swift/Packaging/nsis/swift.nsi
index cff4a92..f8e592d 100644
--- a/Swift/Packaging/nsis/swift.nsi
+++ b/Swift/Packaging/nsis/swift.nsi
@@ -33,12 +33,20 @@ SetCompressor lzma
 !insertmacro MUI_UNPAGE_CONFIRM
 !insertmacro MUI_UNPAGE_INSTFILES
 
-Function .onInit
+!macro checkNotRunning
   FindProcDLL::FindProc "Swift.exe"
   IntCmp $R0 1 0 notRunning
     MessageBox MB_OK|MB_ICONEXCLAMATION "Swift is running. Please close it first" /SD IDOK
     Abort
   notRunning:
+!macroend
+
+Function .onInit
+!insertmacro checkNotRunning
+FunctionEnd
+
+Function un.onInit
+!insertmacro checkNotRunning
 FunctionEnd
 
 # default section start
@@ -122,6 +130,7 @@ sectionEnd
 # create a section to define what the uninstaller does.
 # the section will always be named "Uninstall"
 section "Uninstall"
+    
     # Always delete uninstaller first
     delete $INSTDIR\uninstaller.exe
  
-- 
cgit v0.10.2-6-g49f6