]> git.lyx.org Git - features.git/blobdiff - development/Win32/packaging/installer/setup/uninstall.nsh
Consider inset strings in simple find/replaceAll (#12049)
[features.git] / development / Win32 / packaging / installer / setup / uninstall.nsh
index fb880401d312a6cecbc8e86987e8a3334e229e02..46419a86ba14c6fa44a1a6ee96fc1b210dac3905 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/*
 
 uninstall.nsh
 
@@ -32,11 +32,6 @@ Section "un.LyX" un.SecUnProgramFiles
   
   # ImageMagick
   RMDir /r "$INSTDIR\imagemagick"
-  ReadRegStr $0 SHCTX "SOFTWARE\ImageMagick" "OnlyWithLyX" # test if it was installed together with this LyX version
-  ${if} $0 == "Yes${APP_SERIES_KEY}"
-   WriteRegStr SHCTX "SOFTWARE\Classes\Applications" "AutoRun" ""
-   DeleteRegKey SHCTX "Software\ImageMagick"
-  ${endif}
   
   # Components of Ghostscript
   RMDir /r "$INSTDIR\ghostscript"
@@ -63,7 +58,7 @@ Section "un.LyX" un.SecUnProgramFiles
    ${endif}
   ${endif}
   ${if} $MultiUser.Privileges == "Admin"
-   DeleteRegKey HKCR "LyX.Document"
+   DeleteRegKey HKCR "${APP_NAME}.Document"
   ${endif}
 
   # Uninstaller itself
@@ -73,11 +68,29 @@ Section "un.LyX" un.SecUnProgramFiles
   SetOutPath "$TEMP"
   RMDir /r "$INSTDIR"
   
-  # Registry keys
+  # Registry keys and values
+  DeleteRegValue SHCTX "subkey" "key_name"
   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
   DeleteRegKey SHCTX "${APP_REGKEY}"
   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
-  DeleteRegKey HKCR "Applications\lyx.exe"
+  DeleteRegKey HKCR "Applications\${BIN_LYX}"
+  DeleteRegValue HKCR "${APP_NAME}.Document\Shell\open\command" ""
+  DeleteRegValue HKCR "${APP_NAME}.Document\DefaultIcon" ""
+  ReadRegStr $0 SHCTX ${APP_REGFOLDER} "latestVersion"
+  ${If} $0 == ${APP_SERIES_KEY}
+    DeleteRegValue SHCTX ${APP_REGFOLDER} "latestVersion"
+    StrCpy $0 0
+    StrCpy $R0 ""
+    ${Do}
+      StrCpy $R1 $R0
+      EnumRegKey $R0 SHCTX ${APP_REGFOLDER} $0
+      IntOp $0 $0 + 1
+    ${LoopUntil} $R0 == ""
+    ${If} $R1 != ""
+      WriteRegStr SHCTX ${APP_REGFOLDER} "latestVersion" $R1
+    ${EndIf}
+  ${EndIf}
+  DeleteRegKey /ifempty SHCTX ${APP_REGFOLDER}
   
   # File associations
   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
@@ -112,12 +125,14 @@ Section /o "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
  # remove LyX's config files
  StrCpy $AppSubfolder ${APP_DIR_USERDATA}
  Call un.DelAppPathSub # function from LyXUtils.nsh
+ # remove registry settings
+ DeleteRegKey HKCU "Software\${APP_NAME}\${APP_NAME}${APP_SERIES_NAME}"
   
 SectionEnd
 
 #---------------------------------
 # MiKTeX
-Section /o "un.MiKTeX" un.SecUnMiKTeX
+Section "un.MiKTeX" un.SecUnMiKTeX
 
  ${if} $LaTeXInstalled == "MiKTeX" # only uninstall MiKTeX when it was installed together with LyX 
   ReadRegStr $1 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\MiKTeX ${MiKTeXDeliveredVersion}" "UninstallString"
@@ -126,34 +141,10 @@ Section /o "un.MiKTeX" un.SecUnMiKTeX
 
 SectionEnd
 
-#---------------------------------
-# JabRef
-Section "un.JabRef" un.SecUnJabRef
-
- ${if} $JabRefInstalled == "Yes" # only uninstall JabRef when it was installed together with LyX
-  ${If} $MultiUser.Privileges == "Admin"
-  ${OrIf} $MultiUser.Privileges == "Power"
-   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef" "UninstallString"
-   IfSilent 0 +2
-   ExecWait "$1 /S" # run JabRef's uninstaller
-   ExecWait "$1" # run JabRef's uninstaller
-   DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef"
-  ${else}
-   ReadRegStr $1 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef" "UninstallString"
-   IfSilent 0 +2
-   ExecWait "$1 /S" # run JabRef's uninstaller
-   ExecWait "$1" # run JabRef's uninstaller
-   DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef"
-  ${endif}
- ${endif}
-
-SectionEnd
-
 #---------------------------------
 # Section descriptions
 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
-!insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END