Win inssaller: cleanup and support for thumbnails

- remove unused file
- register DLL file to view thumbnails in Windows explorer (if the user has admin permissions)
- some code simplifications
This commit is contained in:
donovaly
2019-11-14 03:25:50 +01:00
committed by wwmayer
parent 5807ee2022
commit e6de800d4d
9 changed files with 24 additions and 66 deletions

View File

@@ -75,9 +75,6 @@ Section -Configure
${if} $CreateFileAssociations == "true"
WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
${endif}
${if} $CreateFileAssociations == "true"
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
@@ -90,9 +87,15 @@ Section -Configure
# .FCStd
WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
# FIXME: what about .FCMat and .FCMacro?
# Refresh shell
# if the user is admin, also install the DLL toe preview .FCStd files
${if} $MultiUser.Privileges == "Admin"
# see https://nsis.sourceforge.io/Docs/AppendixB.html#library_install for a description of InstallLib
!insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED ${FILES_THUMBS}\FCStdThumbnail.dll $SYSDIR\FCStdThumbnail.dll $SYSDIR
${endif}
# in any case remove the FCStdThumbnail.dll
RMDir /r "$INSTDIR\thumbnail"
# Eventually refresh shell icons
${RefreshShellIcons}
${endif}

View File

@@ -44,6 +44,7 @@ Section -ProgramFiles SecProgramFiles
File /r "${FILES_FREECAD}\lib"
File /r "${FILES_FREECAD}\Mod"
File /r "${FILES_FREECAD}\resources"
File /r "${FILES_THUMBS}"
# Create uninstaller
WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"

View File

@@ -28,6 +28,8 @@ Section "un.FreeCAD" un.SecUnProgramFiles
${endif}
${if} $MultiUser.Privileges == "Admin"
DeleteRegKey HKCR "${APP_NAME}.Document"
# see https://nsis.sourceforge.io/Docs/AppendixB.html#library_install for a description of UnInstallLib
!insertmacro UnInstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED $SYSDIR\FCStdThumbnail.dll
${endif}
# Uninstaller itself
@@ -55,6 +57,9 @@ Section "un.FreeCAD" un.SecUnProgramFiles
# clean other registry entries
DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
DeleteRegKey SHCTX "SOFTWARE\${APP_REGKEY}"
# Eventually refresh shell icons
${RefreshShellIcons}
SectionEnd