diff --git a/src/WindowsInstaller/FreeCAD-installer.nsi b/src/WindowsInstaller/FreeCAD-installer.nsi index 2ceeea5987..eb98272bad 100644 --- a/src/WindowsInstaller/FreeCAD-installer.nsi +++ b/src/WindowsInstaller/FreeCAD-installer.nsi @@ -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 diff --git a/src/WindowsInstaller/Settings.nsh b/src/WindowsInstaller/Settings.nsh index b4d66973cb..9c38df1513 100644 --- a/src/WindowsInstaller/Settings.nsh +++ b/src/WindowsInstaller/Settings.nsh @@ -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" diff --git a/src/WindowsInstaller/include/declarations.nsh b/src/WindowsInstaller/include/declarations.nsh index 5b79a4bfb3..03e26d9b6a 100644 --- a/src/WindowsInstaller/include/declarations.nsh +++ b/src/WindowsInstaller/include/declarations.nsh @@ -69,7 +69,6 @@ Var CreateFileAssociations Var OldVersionNumber Var Pointer Var Search -Var SVGPath Var StartmenuFolder Var String Var UserList diff --git a/src/WindowsInstaller/include/detection.nsh b/src/WindowsInstaller/include/detection.nsh deleted file mode 100644 index 28fb4a803d..0000000000 --- a/src/WindowsInstaller/include/detection.nsh +++ /dev/null @@ -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 - -# --------------------------------------- diff --git a/src/WindowsInstaller/include/init.nsh b/src/WindowsInstaller/include/init.nsh index 145a38d025..c6b5a534ca 100644 --- a/src/WindowsInstaller/include/init.nsh +++ b/src/WindowsInstaller/include/init.nsh @@ -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} diff --git a/src/WindowsInstaller/setup/configure.nsh b/src/WindowsInstaller/setup/configure.nsh index 7b576fae4e..70d9a900c8 100644 --- a/src/WindowsInstaller/setup/configure.nsh +++ b/src/WindowsInstaller/setup/configure.nsh @@ -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} diff --git a/src/WindowsInstaller/setup/install.nsh b/src/WindowsInstaller/setup/install.nsh index cc186b4a25..6b9f689158 100644 --- a/src/WindowsInstaller/setup/install.nsh +++ b/src/WindowsInstaller/setup/install.nsh @@ -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}" diff --git a/src/WindowsInstaller/setup/uninstall.nsh b/src/WindowsInstaller/setup/uninstall.nsh index 9dbbb89658..bb70129448 100644 --- a/src/WindowsInstaller/setup/uninstall.nsh +++ b/src/WindowsInstaller/setup/uninstall.nsh @@ -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 diff --git a/src/WindowsInstaller/thumbnail/FCStdThumbnail.dll b/src/WindowsInstaller/thumbnail/FCStdThumbnail.dll new file mode 100644 index 0000000000..422727663d Binary files /dev/null and b/src/WindowsInstaller/thumbnail/FCStdThumbnail.dll differ