summaryrefslogtreecommitdiff
path: root/distribution/win32
diff options
context:
space:
mode:
Diffstat (limited to 'distribution/win32')
-rw-r--r--distribution/win32/nsis/CMakeLists.txt12
-rw-r--r--distribution/win32/nsis/install.nsh27
-rw-r--r--distribution/win32/nsis/uninstall.nsh29
3 files changed, 47 insertions, 21 deletions
diff --git a/distribution/win32/nsis/CMakeLists.txt b/distribution/win32/nsis/CMakeLists.txt
index 40d3990..150fe43 100644
--- a/distribution/win32/nsis/CMakeLists.txt
+++ b/distribution/win32/nsis/CMakeLists.txt
@@ -1,17 +1,23 @@
STRING(REPLACE "/" "\\\\" NATIVE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(CPACK_GENERATOR "NSIS")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "XTrackCAD")
+SET(CPACK_NSIS_EXECUTABLE_NAME "bin\\\\xtrkcad.exe")
+SET(CPACK_NSIS_DISPLAY_NAME "XTrackCAD ${CPACK_PACKAGE_VERSION}")
SET(CPACK_PACKAGE_ICON "${NATIVE_CURRENT_SOURCE_DIR}\\\\headerimage.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\xtrkcad.exe")
SET(CPACK_NSIS_HELP_LINK "http://www.xtrkcad.org")
+SET(CPACK_NSIS_MUI_FINISHPAGE_RUN "xtrkcad.exe")
+set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "on")
+
+SET(CPACK_NSIS_STARTMENU_FOLDER "XTrackCAD")
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"; add part specific to XTrackCAD installation
!include \\\"${NATIVE_CURRENT_SOURCE_DIR}\\\\install.nsh\\\"")
-
+
SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
"; add part specific to XTrackCAD uninstall
!include \\\"${NATIVE_CURRENT_SOURCE_DIR}\\\\uninstall.nsh\\\"")
-
-INCLUDE(CPack)
+INCLUDE(CPack)
diff --git a/distribution/win32/nsis/install.nsh b/distribution/win32/nsis/install.nsh
index dc4ed80..0fc948d 100644
--- a/distribution/win32/nsis/install.nsh
+++ b/distribution/win32/nsis/install.nsh
@@ -5,9 +5,9 @@
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\XTrackCAD Help.lnk" "$INSTDIR\share\xtrkcad\xtrkcad.chm" "" "" 0
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\XTrackCAD ReadMe.lnk" "notepad.exe" "$INSTDIR\share\xtrkcad\ReadMe.txt"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\XTrackCAD CHANGELOG.lnk" "notepad.exe" "$INSTDIR\share\xtrkcad\CHANGELOG.txt"
-
-
-;
+
+
+;
; create file association
;
; back up old value of .xtc
@@ -17,14 +17,23 @@ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\XTrackCAD CHANGELOG.lnk" "notepad.
StrCmp $1 "XTrackCAD.Design" "${Index}-NoBackup"
WriteRegStr HKCR ".xtc" "backup_val" $1
"${Index}-NoBackup:"
-
-; create the new association
+
+ ; back up old value of .xtce
+ !define /redef Index "Line${__LINE__}"
+ ReadRegStr $1 HKCR ".xtce" ""
+ StrCmp $1 "" "${Index}-NoBackup"
+ StrCmp $1 "XTrackCAD.Design" "${Index}-NoBackup"
+ WriteRegStr HKCR ".xtce" "backup_xtce" $1
+ "${Index}-NoBackup:"
+
+; create the new association
WriteRegStr HKCR ".xtc" "" "XTrackCAD.Design"
+ WriteRegStr HKCR ".xtce" "" "XTrackCAD.Design"
WriteRegStr HKCR "XTrackCAD.Design" "" "XTrackCAD Layout Design"
WriteRegStr HKCR "XTrackCAD.Design\shell" "" "open"
- WriteRegStr HKCR "XTrackCAD.Design\DefaultIcon" "" "$INSTDIR\bin\xtrkcad.exe,0"
+ WriteRegStr HKCR "XTrackCAD.Design\DefaultIcon" "" '$INSTDIR\bin\xtrkcad.exe,0'
WriteRegStr HKCR "XTrackCAD.Design\shell\open\command" "" '$INSTDIR\bin\xtrkcad.exe "%1"'
-
+
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
-
- !undef Index \ No newline at end of file
+
+ !undef Index
diff --git a/distribution/win32/nsis/uninstall.nsh b/distribution/win32/nsis/uninstall.nsh
index b568e21..3f47586 100644
--- a/distribution/win32/nsis/uninstall.nsh
+++ b/distribution/win32/nsis/uninstall.nsh
@@ -1,8 +1,8 @@
;
-; additional uninstaller instructions
+; additional uninstaller instructions
;
-; Remove file association
+; Remove file association xtc
!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".xtc" ""
StrCmp $1 "XTrackCAD.Design" 0 "${Index}-NoOwn" ; only do this if we own it
@@ -13,18 +13,29 @@
"${Index}-Restore:"
WriteRegStr HKCR ".xtc" "" $1
DeleteRegValue HKCR ".xtc" "backup_val"
-
+
+"${Index}-NoOwn:"
+; Remove file association xtce
+ !define /redef Index "Line${__LINE__}"
+ ReadRegStr $1 HKCR ".xtce" ""
+ StrCmp $1 "XTrackCAD.Design" 0 "${Index}-NoOwn" ; only do this if we own it
+ ReadRegStr $1 HKCR ".xtce" "backup_xtce"
+ StrCmp $1 "" 0 "${Index}-Restore" ; if backup="" then delete the whole key
+ DeleteRegKey HKCR ".xtce"
+ Goto "${Index}-NoOwn"
+ "${Index}-Restore:"
+ WriteRegStr HKCR ".xtce" "" $1
+ DeleteRegValue HKCR ".xtce" "backup_xtce"
+
DeleteRegKey HKCR "XTrackCAD.Design" ;Delete key with association settings
-
+
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
"${Index}-NoOwn:"
!undef Index
; Remove shortcuts, if any
-; SetShellVarContext all
+SetShellVarContext all
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
-
-Delete "$SMPROGRAMS\$MUI_TEMP\XTrkCad Help.lnk"
-Delete "$SMPROGRAMS\$MUI_TEMP\XTrkCad ReadMe.lnk"
- \ No newline at end of file
+RMDir /r "$SMPROGRAMS\$MUI_TEMP"
+Delete "$desktop\XTrackCAD.lnk"