]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/setup/uninstall.nsh
2eeaa07d487c40cdcb30ce537951faa96772ff5e
[lyx.git] / development / Win32 / packaging / installer / setup / uninstall.nsh
1 /*
2
3 uninstall.nsh
4
5 Uninstall 
6
7 */
8
9 Var FileAssociation
10
11 # ----------------------------------
12
13 Section "un.LyX" un.SecUnProgramFiles
14
15   # LaTeX class files that were installed together with LyX
16   # will not be uninstalled because other LyX versions will
17   # need them and these few files don't harm to stay in LaTeX 
18     
19   # Binaries
20   #!insertmacro FileListLyXBin Delete "$INSTDIR\bin\"
21   #!insertmacro FileListQtBin Delete "$INSTDIR\bin\"
22   #!insertmacro FileListDll Delete "$INSTDIR\bin\"
23   #!insertmacro FileListMSVC Delete "$INSTDIR\bin\"
24   #!insertmacro FileListNetpbmBin Delete "$INSTDIR\bin\"
25   #!insertmacro FileListDTLBin Delete "$INSTDIR\bin\"
26   #!insertmacro FileListDvipostBin Delete "$INSTDIR\bin\"
27   #!insertmacro FileListPDFToolsBin Delete "$INSTDIR\bin\"
28   #!insertmacro FileListPDFViewBin Delete "$INSTDIR\bin\"
29   #!insertmacro FileListMetaFile2EPS Delete "$INSTDIR\bin\"
30   RMDir /r "$INSTDIR\bin"
31
32   # Resources
33   RMDir /r "$INSTDIR\Resources"
34   
35   # Python
36   RMDir /r "$INSTDIR\python"
37   
38   # Components of ImageMagick
39   #!insertmacro FileListImageMagick Delete "$INSTDIR\imagemagick\"
40   #!insertmacro FileListMSVC Delete "$INSTDIR\imagemagick\"
41   RMDir /r "$INSTDIR\imagemagick"
42   
43   # Components of Ghostscript
44   #!insertmacro FileListGhostscript Delete "$INSTDIR\ghostscript\"
45   #!insertmacro FileListMSVC Delete "$INSTDIR\ghostscript\"
46   RMDir /r "$INSTDIR\ghostscript"
47   
48   # delete start menu folder
49   ReadRegStr $0 SHCTX "${APP_UNINST_KEY}" "StartMenu"
50   RMDir /r "$0"
51   #Delete "$SMPROGRAMS\${APP_NAME} ${APP_SERIES_NAME}.lnk"
52   # delete desktop icon
53   Delete "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
54   
55   # remove file extension .lyx
56   ReadRegStr $0 SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" # special entry to test if they were registered by this LyX version
57   ${if} $0 == "Yes${APP_SERIES_KEY}"
58    ReadRegStr $R0 SHCTX "Software\Classes\${APP_EXT}" ""
59    ${if} $R0 == "${APP_REGNAME_DOC}"
60     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}13"
61     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}14"
62     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}15"
63     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}16"
64     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}"
65     DeleteRegKey SHCTX "Software\Classes\${APP_REGNAME_DOC}"
66    ${endif}
67   ${endif}
68   ${if} $MultiUser.Privileges == "Admin"
69    DeleteRegKey HKCR "LyX.Document"
70   ${endif}
71
72   # Uninstaller itself
73   Delete "$INSTDIR\${SETUP_UNINSTALLER}"
74   
75   # Application folder
76   SetOutPath "$TEMP"
77   RMDir /r "$INSTDIR"
78   
79   # Registry keys
80   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
81   DeleteRegKey SHCTX "${APP_REGKEY}"
82   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
83   DeleteRegKey HKCR "Applications\lyx.exe"
84   
85   # File associations
86   
87   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
88   
89   ${If} $FileAssociation == "${APP_REGNAME_DOC}"
90      DeleteRegKey SHELL_CONTEXT "Software\Classes\${APP_EXT}"
91   ${EndIf}
92   
93   ${If} $MultiUser.Privileges != "Admin"
94     ${OrIf} $MultiUser.Privileges != "Power"
95
96     # Delete Postscript printer for metafile to EPS conversion
97     ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
98
99   ${EndIf}
100   
101   # clean other registry entries
102   DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
103   DeleteRegKey SHCTX "SOFTWARE\${APP_REGKEY}"
104   
105
106 SectionEnd
107
108 #---------------------------------
109 # user preferences
110 Section /o "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
111
112  # remove LyX's config files
113  StrCpy $AppSubfolder ${APP_DIR_USERDATA}
114  Call un.DelAppPathSub # function from LyXUtils.nsh
115   
116 SectionEnd
117
118 #---------------------------------
119 # MiKTeX
120 Section /o "un.MiKTeX" un.SecUnMiKTeX
121
122  ${if} $LaTeXInstalled == "MiKTeX" # only uninstall MiKTeX when it was installed together with LyX 
123   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MiKTeX ${MiKTeXDeliveredVersion}" "UninstallString"
124   ExecWait $1 # run MiKTeX's uninstaller
125  ${endif}
126
127 SectionEnd
128
129 #---------------------------------
130 # JabRef
131 Section "un.JabRef" un.SecUnJabRef
132
133  ${if} $JabRefInstalled == "Yes" # only uninstall JabRef when it was installed together with LyX 
134   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"
135   ExecWait "$1" # run JabRef's uninstaller
136  ${endif}
137
138 SectionEnd
139
140 #---------------------------------
141 # Section descriptions
142 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
143 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
144 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
145 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
146 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
147 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
148
149 #Section "un.User Preferences and Custom Files" un.SecUserFiles
150 #
151 #  SetShellVarContext current
152 #  RMDir /r "$APPDATA\${APP_DIR_USERDATA}"
153 #  
154 #SectionEnd