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

@@ -34,23 +34,22 @@ ManifestDPIAware true
!define MULTIUSER_MUI
# included NSIS files
!include MUI2.nsh
!include InstallOptions.nsh
!include LangFile.nsh
!include Library.nsh
!include LogicLib.nsh
!include MUI2.nsh
!include MultiUser.nsh
!include Sections.nsh
!include WinVer.nsh
!include LangFile.nsh
!include MultiUser.nsh
!include InstallOptions.nsh
!include x64.nsh
# load the nsPprocess plugin
!include nsProcess.nsh
# Set of various macros and functions
!include include\utils.nsh
# detect third-party programs
!include include\detection.nsh
# set up the installer pages
!include include\gui.nsh

View File

@@ -18,7 +18,7 @@ SetCompressor /SOLID lzma
!define APP_VERSION_MAJOR 0
!define APP_VERSION_MINOR 19
!define APP_VERSION_REVISION 0
!define APP_VERSION_EMERGENCY "rev18542" # use "1" for an emergency release of FreeCAD otherwise ""
!define APP_VERSION_EMERGENCY "rev18731" # use "1" for an emergency release of FreeCAD otherwise ""
# alternatively you can use APP_VERSION_EMERGENCY for a custom suffix of the version number
!define APP_EMERGENCY_DOT "" # use "." for an emergency release of FreeCAD otherwise ""
!define APP_VERSION_BUILD 1 # Start with 1 for the installer releases of each version
@@ -45,3 +45,4 @@ SetCompressor /SOLID lzma
!define FILES_FREECAD "D:\usti\FreeCAD\Installer\FreeCAD"
!define FILES_DEPS "D:\usti\FreeCAD\Installer\MSVCRedist"
!define FILES_THUMBS "D:\usti\FreeCAD\Installer\thumbnail"

View File

@@ -69,7 +69,6 @@ Var CreateFileAssociations
Var OldVersionNumber
Var Pointer
Var Search
Var SVGPath
Var StartmenuFolder
Var String
Var UserList

View File

@@ -1,46 +0,0 @@
/*
detection.nsh
Detection of external component locations
*/
# This script contains the following functions:
#
# - SearchExternal, calls the functions:
# MissingPrograms
#
# - MissingPrograms, (check if third-party programs are installed), uses:
# SEARCH_MIKTEX
# SEARCH_TEXLIVE
#
#--------------------------
Function SearchExternal
Call MissingPrograms
FunctionEnd
# ---------------------------------------
Function MissingPrograms
# check if third-party programs are installed
${if} ${RunningX64}
SetRegView 64
${endif}
# test if Inkscape is installed
ReadRegStr $SVGPath HKLM "SOFTWARE\Classes\inkscape.svg\DefaultIcon" ""
${if} $SVGPath != ""
StrCpy $SVGPath $SVGPath "" 1 # remove the leading quote
StrCpy $SVGPath $SVGPath -14 # # delete '\inkscape.exe"'
${endif}
${if} $SVGPath == ""
# this was used before Inkscape 0.91:
ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
${endif}
FunctionEnd
# ---------------------------------------

View File

@@ -60,6 +60,7 @@ Function .onInit
# check if it is a 64bit system
${if} ${RunningX64}
SetRegView 64
!define LIBRARY_X64
${endif}
# Check that FreeCAD is not currently running
@@ -149,11 +150,6 @@ Function .onInit
${IfNot} ${Silent}
# Show banner while installer is intializating
Banner::show /NOUNLOAD "Checking system"
${EndIf}
Call SearchExternal
${IfNot} ${Silent}
Banner::destroy
${EndIf}

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

Binary file not shown.