forked from bots-garden/ori
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 1 | Unicode true |
| 2 | ||
| 3 | #### | |
| 4 | ## Please note: Template replacements don't work in this file. They are provided with default defines like | |
| 5 | ## mentioned underneath. | |
| 6 | ## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo. | |
| 7 | ## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually | |
| 8 | ## from outside of Wails for debugging and development of the installer. | |
| 9 | ## | |
| 10 | ## For development first make a wails nsis build to populate the "wails_tools.nsh": | |
| 11 | ## > wails build --target windows/amd64 --nsis | |
| 12 | ## Then you can call makensis on this file with specifying the path to your binary: | |
| 13 | ## For a AMD64 only installer: | |
| 14 | ## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe | |
| 15 | ## For a ARM64 only installer: | |
| 16 | ## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe | |
| 17 | ## For a installer with both architectures: | |
| 18 | ## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe | |
| 19 | #### | |
| 20 | ## The following information is taken from the ProjectInfo file, but they can be overwritten here. | |
| 21 | #### | |
| 22 | ## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}" | |
| 23 | ## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}" | |
| 24 | ## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}" | |
| 25 | ## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}" | |
| 26 | ## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}" | |
| 27 | ### | |
| 28 | ## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe" | |
| 29 | ## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}" | |
| 30 | #### | |
| 31 | ## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html | |
| 32 | #### | |
| 33 | ## Include the wails tools | |
| 34 | #### | |
| 35 | !include "wails_tools.nsh" | |
| 36 | ||
| 37 | # The version information for this two must consist of 4 parts | |
| 38 | VIProductVersion "${INFO_PRODUCTVERSION}.0" | |
| 39 | VIFileVersion "${INFO_PRODUCTVERSION}.0" | |
| 40 | ||
| 41 | VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}" | |
| 42 | VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer" | |
| 43 | VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}" | |
| 44 | VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}" | |
| 45 | VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}" | |
| 46 | VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}" | |
| 47 | ||
| 48 | # Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware | |
| 49 | ManifestDPIAware true | |
| 50 | ||
| 51 | !include "MUI.nsh" | |
| 52 | ||
| 53 | !define MUI_ICON "..\icon.ico" | |
| 54 | !define MUI_UNICON "..\icon.ico" | |
| 55 | # !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314 | |
| 56 | !define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps | |
| 57 | !define MUI_ABORTWARNING # This will warn the user if they exit from the installer. | |
| 58 | ||
| 59 | !insertmacro MUI_PAGE_WELCOME # Welcome to the installer page. | |
| 60 | # !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer | |
| 61 | !insertmacro MUI_PAGE_DIRECTORY # In which folder install page. | |
| 62 | !insertmacro MUI_PAGE_INSTFILES # Installing page. | |
| 63 | !insertmacro MUI_PAGE_FINISH # Finished installation page. | |
| 64 | ||
| 65 | !insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page | |
| 66 | ||
| 67 | !insertmacro MUI_LANGUAGE "English" # Set the Language of the installer | |
| 68 | ||
| 69 | ## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1 | |
| 70 | #!uninstfinalize 'signtool --file "%1"' | |
| 71 | #!finalize 'signtool --file "%1"' | |
| 72 | ||
| 73 | Name "${INFO_PRODUCTNAME}" | |
| 74 | OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file. | |
| 75 | !ifdef WAILS_INSTALL_SCOPE | |
| 76 | !if "${WAILS_INSTALL_SCOPE}" == "user" | |
| 77 | InstallDir "$LOCALAPPDATA\Programs\${INFO_PRODUCTNAME}" | |
| 78 | !else | |
| 79 | InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" | |
| 80 | !endif | |
| 81 | !else | |
| 82 | InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" | |
| 83 | !endif # Default installing folder ($PROGRAMFILES is Program Files folder). | |
| 84 | ShowInstDetails show # This will always show the installation details. | |
| 85 | ||
| 86 | Function .onInit | |
| 87 | !insertmacro wails.checkArchitecture | |
| 88 | FunctionEnd | |
| 89 | ||
| 90 | Section | |
| 91 | !insertmacro wails.setShellContext | |
| 92 | ||
| 93 | !insertmacro wails.webview2runtime | |
| 94 | ||
| 95 | SetOutPath $INSTDIR | |
| 96 | ||
| 97 | !insertmacro wails.files | |
| 98 | ||
| 99 | CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" | |
| 100 | CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" | |
| 101 | ||
| 102 | !insertmacro wails.associateFiles | |
| 103 | !insertmacro wails.associateCustomProtocols | |
| 104 | ||
| 105 | !insertmacro wails.writeUninstaller | |
| 106 | SectionEnd | |
| 107 | ||
| 108 | Section "uninstall" | |
| 109 | !insertmacro wails.setShellContext | |
| 110 | ||
| 111 | RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath | |
| 112 | ||
| 113 | RMDir /r $INSTDIR | |
| 114 | ||
| 115 | Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" | |
| 116 | Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk" | |
| 117 | ||
| 118 | !insertmacro wails.unassociateFiles | |
| 119 | !insertmacro wails.unassociateCustomProtocols | |
| 120 | ||
| 121 | !insertmacro wails.deleteUninstaller | |
| 122 | SectionEnd |