Skip to content

desktop/src-tauri/installer/windows.nsi

Comment 1, line 1

desktop/src-tauri/installer/windows.nsi:1

; Based on Tauri CLI v2.12.0, MIT license in LICENSE-MIT.upstream.

Comment 2, line 2

desktop/src-tauri/installer/windows.nsi:2

; Source: https://raw.githubusercontent.com/tauri-apps/tauri/tauri-cli-v2.12.0/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi

Comment 3, line 3

desktop/src-tauri/installer/windows.nsi:3

; Local change: the executable cleanup owns autostart removal; preserve foreign values.

Comment 4, line 6

desktop/src-tauri/installer/windows.nsi:6

; Add dpiAwareness=PerMonitorV2 for Windows 10 1607+; older systems retain ManifestDPIAware true.

Comment 5, line 7

desktop/src-tauri/installer/windows.nsi:7

; Fixed NSIS source documentation references for this manifest setting:

Comment 6, line 8

desktop/src-tauri/installer/windows.nsi:8

; https://github.com/kichik/nsis/blob/5fc0b87b819a9eec006df4967d08e522ddd651c9/Docs/src/attributes.but#L286-L300

Comment 7, line 9

desktop/src-tauri/installer/windows.nsi:9

; https://github.com/tauri-apps/tauri/pull/10106

Comment 8, line 15

desktop/src-tauri/installer/windows.nsi:15

; Set the compression algorithm. We default to LZMA.

Comment 9, line 19

desktop/src-tauri/installer/windows.nsi:19

; Keep above !include to stay ahead of any plugin command

Comment 10, line 20

desktop/src-tauri/installer/windows.nsi:20

; see https://github.com/tauri-apps/tauri/pull/15422#discussion_r3289239624

Comment 11, line 87

desktop/src-tauri/installer/windows.nsi:87

; We don't actually use this value as default install path,

Comment 12, line 88

desktop/src-tauri/installer/windows.nsi:88

; it's just for nsis to append the product name folder in the directory selector

Comment 13, line 89

desktop/src-tauri/installer/windows.nsi:89

; https://nsis.sourceforge.io/Reference/InstallDir

Comment 14, line 100

desktop/src-tauri/installer/windows.nsi:100

# additional plugins

Comment 15, line 103

desktop/src-tauri/installer/windows.nsi:103

; Uninstaller signing command

Comment 16, line 108

desktop/src-tauri/installer/windows.nsi:108

; Handle install mode: currentUser, perMachine or both.

Comment 17, line 134

desktop/src-tauri/installer/windows.nsi:134

; Installer icon

Comment 18, line 139

desktop/src-tauri/installer/windows.nsi:139

; Installer sidebar image

Comment 19, line 144

desktop/src-tauri/installer/windows.nsi:144

; Enable header images for installer and uninstaller pages when either image is configured.

Comment 20, line 151

desktop/src-tauri/installer/windows.nsi:151

; Installer header image

Comment 21, line 156

desktop/src-tauri/installer/windows.nsi:156

; Uninstaller header image

Comment 22, line 161

desktop/src-tauri/installer/windows.nsi:161

; Uninstaller icon

Comment 23, line 166

desktop/src-tauri/installer/windows.nsi:166

; Define registry key to store installer language

Comment 24, line 171

desktop/src-tauri/installer/windows.nsi:171

; Installer pages, must be ordered as they appear

Comment 25, line 172

desktop/src-tauri/installer/windows.nsi:172

; 1. Welcome Page

Comment 26, line 176

desktop/src-tauri/installer/windows.nsi:176

; 2. License Page (if defined)

Comment 27, line 182

desktop/src-tauri/installer/windows.nsi:182

; 3. Install mode (if it is set to `both`)

Comment 28, line 188

desktop/src-tauri/installer/windows.nsi:188

; 4. Custom page to ask user if he wants to reinstall/uninstall

Comment 29, line 189

desktop/src-tauri/installer/windows.nsi:189

; only if a previous installation was detected

Comment 30, line 193

desktop/src-tauri/installer/windows.nsi:193

; Find a matching previous WiX installation.

Comment 31, line 194

desktop/src-tauri/installer/windows.nsi:194

;

Comment 32, line 195

desktop/src-tauri/installer/windows.nsi:195

; A WiX installer stores the installation info in registry

Comment 33, line 196

desktop/src-tauri/installer/windows.nsi:196

; using a UUID and so we have to loop through all keys under

Comment 34, line 197

desktop/src-tauri/installer/windows.nsi:197

; `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`

Comment 35, line 198

desktop/src-tauri/installer/windows.nsi:198

; and check if `DisplayName` and `Publisher` keys match ${PRODUCTNAME} and ${MANUFACTURER}

Comment 36, line 199

desktop/src-tauri/installer/windows.nsi:199

;

Comment 37, line 200

desktop/src-tauri/installer/windows.nsi:200

; This has a potential issue that there maybe another installation that matches

Comment 38, line 201

desktop/src-tauri/installer/windows.nsi:201

; our ${PRODUCTNAME} and ${MANUFACTURER} but wasn't installed by our WiX installer,

Comment 39, line 202

desktop/src-tauri/installer/windows.nsi:202

; however, this should be fine since the user will have to confirm the uninstallation

Comment 40, line 203

desktop/src-tauri/installer/windows.nsi:203

; and they can chose to abort it if doesn't make sense.

Comment 41, line 207

desktop/src-tauri/installer/windows.nsi:207

; Exit loop if there is no more keys to loop on

Comment 42, line 221

desktop/src-tauri/installer/windows.nsi:221

; Check if there is an existing installation, if not, abort the reinstall page

Comment 43, line 226

desktop/src-tauri/installer/windows.nsi:226

; Compare this installer version with the existing installation

Comment 44, line 227

desktop/src-tauri/installer/windows.nsi:227

; and modify the messages presented to the user accordingly

Comment 45, line 239

desktop/src-tauri/installer/windows.nsi:239

; Reinstalling the same version

Comment 46, line 245

desktop/src-tauri/installer/windows.nsi:245

; Upgrading

Comment 47, line 251

desktop/src-tauri/installer/windows.nsi:251

; Downgrading

Comment 48, line 265

desktop/src-tauri/installer/windows.nsi:265

; Skip showing the page if passive

Comment 49, line 266

desktop/src-tauri/installer/windows.nsi:266

;

Comment 50, line 267

desktop/src-tauri/installer/windows.nsi:267

; Note that we don't call this earlier at the beginning

Comment 51, line 268

desktop/src-tauri/installer/windows.nsi:268

; of this function because we need to populate some variables

Comment 52, line 269

desktop/src-tauri/installer/windows.nsi:269

; related to current installed version if detected and whether

Comment 53, line 270

desktop/src-tauri/installer/windows.nsi:270

; we are downgrading or not.

Comment 54, line 287

desktop/src-tauri/installer/windows.nsi:287

; Disable this radio button if downgrading and downgrades are disabled

Comment 55, line 293

desktop/src-tauri/installer/windows.nsi:293

; Check the first radio button if this the first time

Comment 56, line 294

desktop/src-tauri/installer/windows.nsi:294

; we enter this page or if the second button wasn't

Comment 57, line 295

desktop/src-tauri/installer/windows.nsi:295

; selected the last time we were on this page

Comment 58, line 317

desktop/src-tauri/installer/windows.nsi:317

; If migrating from Wix, always uninstall

Comment 59, line 322

desktop/src-tauri/installer/windows.nsi:322

; In update mode, always proceeds without uninstalling

Comment 60, line 327

desktop/src-tauri/installer/windows.nsi:327

; $R0 holds whether same(0)/upgrading(1)/downgrading(-1) version

Comment 61, line 328

desktop/src-tauri/installer/windows.nsi:328

; $R1 holds the radio buttons state:

Comment 62, line 329

desktop/src-tauri/installer/windows.nsi:329

; 1 => first choice was selected

Comment 63, line 330

desktop/src-tauri/installer/windows.nsi:330

; 0 => second choice was selected

Comment 64, line 331

desktop/src-tauri/installer/windows.nsi:331

; Same version, proceed

Comment 65, line 332

desktop/src-tauri/installer/windows.nsi:332

; User chose to add/reinstall

Comment 66, line 334

desktop/src-tauri/installer/windows.nsi:334

; User chose to uninstall

Comment 67, line 337

desktop/src-tauri/installer/windows.nsi:337

; Upgrading

Comment 68, line 338

desktop/src-tauri/installer/windows.nsi:338

; User chose to uninstall

Comment 69, line 341

desktop/src-tauri/installer/windows.nsi:341

; User chose NOT to uninstall

Comment 70, line 343

desktop/src-tauri/installer/windows.nsi:343

; Downgrading

Comment 71, line 344

desktop/src-tauri/installer/windows.nsi:344

; User chose to uninstall

Comment 72, line 347

desktop/src-tauri/installer/windows.nsi:347

; User chose NOT to uninstall

Comment 73, line 361

desktop/src-tauri/installer/windows.nsi:361

; append /UPDATE

Comment 74, line 362

desktop/src-tauri/installer/windows.nsi:362

; append /P

Comment 75, line 363

desktop/src-tauri/installer/windows.nsi:363

; append uninstall directory

Comment 76, line 369

desktop/src-tauri/installer/windows.nsi:369

; ExecWait failed, set fake exit code

Comment 77, line 373

desktop/src-tauri/installer/windows.nsi:373

; User cancelled wix uninstaller? return to select un/reinstall page

Comment 78, line 379

desktop/src-tauri/installer/windows.nsi:379

; User cancelled NSIS uninstaller? return to select un/reinstall page

Comment 79, line 384

desktop/src-tauri/installer/windows.nsi:384

; Other errors? show generic error message and return to select un/reinstall page

Comment 80, line 391

desktop/src-tauri/installer/windows.nsi:391

; 5. Choose install directory page

Comment 81, line 395

desktop/src-tauri/installer/windows.nsi:395

; 6. Start menu shortcut page

Comment 82, line 405

desktop/src-tauri/installer/windows.nsi:405

; 7. Installation page

Comment 83, line 408

desktop/src-tauri/installer/windows.nsi:408

; 8. Finish page

Comment 84, line 409

desktop/src-tauri/installer/windows.nsi:409

;

Comment 85, line 410

desktop/src-tauri/installer/windows.nsi:410

; Don't auto jump to finish page after installation page,

Comment 86, line 411

desktop/src-tauri/installer/windows.nsi:411

; because the installation page has useful info that can be used debug any issues with the installer.

Comment 87, line 413

desktop/src-tauri/installer/windows.nsi:413

; Use show readme button in the finish page as a button create a desktop shortcut

Comment 88, line 417

desktop/src-tauri/installer/windows.nsi:417

; Show run app after installation.

Comment 89, line 427

desktop/src-tauri/installer/windows.nsi:427

; Uninstaller Pages

Comment 90, line 428

desktop/src-tauri/installer/windows.nsi:428

; 1. Confirm uninstall page

Comment 91, line 433

desktop/src-tauri/installer/windows.nsi:433

; Add a Delete app data checkbox.

Comment 92, line 434

desktop/src-tauri/installer/windows.nsi:434

; $1 inner dialog HWND

Comment 93, line 435

desktop/src-tauri/installer/windows.nsi:435

; $2 window DPI

Comment 94, line 436

desktop/src-tauri/installer/windows.nsi:436

; $3 style

Comment 95, line 437

desktop/src-tauri/installer/windows.nsi:437

; $4 x

Comment 96, line 438

desktop/src-tauri/installer/windows.nsi:438

; $5 y

Comment 97, line 439

desktop/src-tauri/installer/windows.nsi:439

; $6 width

Comment 98, line 440

desktop/src-tauri/installer/windows.nsi:440

; $7 height

Comment 99, line 441

desktop/src-tauri/installer/windows.nsi:441

; Find inner dialog

Comment 100, line 469

desktop/src-tauri/installer/windows.nsi:469

; 2. Uninstalling Page

Comment 101, line 472

desktop/src-tauri/installer/windows.nsi:472

;Languages

Comment 102, line 504

desktop/src-tauri/installer/windows.nsi:504

; Set default install location

Comment 103, line 532

desktop/src-tauri/installer/windows.nsi:532

; Abort silent installer if downgrades is disabled

Comment 104, line 535

desktop/src-tauri/installer/windows.nsi:535

; If downgrading

Comment 105, line 540

desktop/src-tauri/installer/windows.nsi:540

; set red color

Comment 106, line 551

desktop/src-tauri/installer/windows.nsi:551

; Read the installed WebView2 version and install or update as required.

Comment 107, line 562

desktop/src-tauri/installer/windows.nsi:562

; Webview2 installation

Comment 108, line 563

desktop/src-tauri/installer/windows.nsi:563

;

Comment 109, line 564

desktop/src-tauri/installer/windows.nsi:564

; Skip if updating

Comment 110, line 601

desktop/src-tauri/installer/windows.nsi:601

; $6 holds the path to the webview2 installer

Comment 111, line 626

desktop/src-tauri/installer/windows.nsi:626

; Chromium updater docs: https://source.chromium.org/chromium/chromium/src/+/main:docs/updater/user_manual.md

Comment 112, line 627

desktop/src-tauri/installer/windows.nsi:627

; Modified from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView\ModifyPath"

Comment 113, line 651

desktop/src-tauri/installer/windows.nsi:651

; Copy main executable

Comment 114, line 654

desktop/src-tauri/installer/windows.nsi:654

; Copy resources

Comment 115, line 662

desktop/src-tauri/installer/windows.nsi:662

; Copy external binaries

Comment 116, line 667

desktop/src-tauri/installer/windows.nsi:667

; Create file associations

Comment 117, line 674

desktop/src-tauri/installer/windows.nsi:674

; Register deep links

Comment 118, line 682

desktop/src-tauri/installer/windows.nsi:682

; Create uninstaller

Comment 119, line 685

desktop/src-tauri/installer/windows.nsi:685

; Save $INSTDIR in registry for future installations

Comment 120, line 689

desktop/src-tauri/installer/windows.nsi:689

; Save install mode to be selected by default for the next installation such as updating

Comment 121, line 690

desktop/src-tauri/installer/windows.nsi:690

; or when uninstalling

Comment 122, line 694

desktop/src-tauri/installer/windows.nsi:694

; Remove old main binary if it doesn't match new main binary name

Comment 123, line 701

desktop/src-tauri/installer/windows.nsi:701

; Save current MAINBINARYNAME for future updates

Comment 124, line 704

desktop/src-tauri/installer/windows.nsi:704

; Registry information for add/remove programs

Comment 125, line 725

desktop/src-tauri/installer/windows.nsi:725

; Create start menu shortcut

Comment 126, line 730

desktop/src-tauri/installer/windows.nsi:730

; Create desktop shortcut for silent and passive installers

Comment 127, line 731

desktop/src-tauri/installer/windows.nsi:731

; because finish page will be skipped

Comment 128, line 741

desktop/src-tauri/installer/windows.nsi:741

; Auto close this page for passive mode

Comment 129, line 748

desktop/src-tauri/installer/windows.nsi:748

; Check for `/R` flag only in silent and passive installers because

Comment 130, line 749

desktop/src-tauri/installer/windows.nsi:749

; GUI installer has a toggle for the user to (re)start the app

Comment 131, line 788

desktop/src-tauri/installer/windows.nsi:788

; Delete owned installation files and attempt to remove the installation directory.

Comment 132, line 789

desktop/src-tauri/installer/windows.nsi:789

; Delete main executable.

Comment 133, line 792

desktop/src-tauri/installer/windows.nsi:792

; Delete resources

Comment 134, line 797

desktop/src-tauri/installer/windows.nsi:797

; Delete external binaries

Comment 135, line 802

desktop/src-tauri/installer/windows.nsi:802

; Delete app associations

Comment 136, line 809

desktop/src-tauri/installer/windows.nsi:809

; Delete deep links

Comment 137, line 818

desktop/src-tauri/installer/windows.nsi:818

; Delete uninstaller

Comment 138, line 826

desktop/src-tauri/installer/windows.nsi:826

; Remove shortcuts if not updating

Comment 139, line 830

desktop/src-tauri/installer/windows.nsi:830

; Remove start menu shortcut

Comment 140, line 846

desktop/src-tauri/installer/windows.nsi:846

; Remove desktop shortcuts

Comment 141, line 855

desktop/src-tauri/installer/windows.nsi:855

; Remove registry information for add/remove programs

Comment 142, line 864

desktop/src-tauri/installer/windows.nsi:864

; The executable pre-uninstall cleanup checks this installation's owned HKCU Run value.

Comment 143, line 865

desktop/src-tauri/installer/windows.nsi:865

; Cleanup removes owned autostart content while preserving foreign values.

Comment 144, line 866

desktop/src-tauri/installer/windows.nsi:866

; An absent owned value requires no deletion.

Comment 145, line 867

desktop/src-tauri/installer/windows.nsi:867

; Update mode skips cleanup and retains autostart.

Comment 146, line 869

desktop/src-tauri/installer/windows.nsi:869

; --uninstall-cleanup removed only this installation's autostart value.

Comment 147, line 872

desktop/src-tauri/installer/windows.nsi:872

; Delete app data if the checkbox is selected

Comment 148, line 873

desktop/src-tauri/installer/windows.nsi:873

; and if not updating

Comment 149, line 876

desktop/src-tauri/installer/windows.nsi:876

; Clear the install location $INSTDIR from registry

Comment 150, line 880

desktop/src-tauri/installer/windows.nsi:880

; Clear the install language from registry

Comment 151, line 894

desktop/src-tauri/installer/windows.nsi:894

; Auto close if passive mode or updating

Comment 152, line 919

desktop/src-tauri/installer/windows.nsi:919

; We used to use product name as MAINBINARYNAME

Comment 153, line 920

desktop/src-tauri/installer/windows.nsi:920

; migrate old shortcuts to target the new MAINBINARYNAME

Comment 154, line 941

desktop/src-tauri/installer/windows.nsi:941

; Skip creating shortcut if in update mode or no shortcut mode

Comment 155, line 942

desktop/src-tauri/installer/windows.nsi:942

; but always create if migrating from wix

Comment 156, line 961

desktop/src-tauri/installer/windows.nsi:961

; We used to use product name as MAINBINARYNAME

Comment 157, line 962

desktop/src-tauri/installer/windows.nsi:962

; migrate old shortcuts to target the new MAINBINARYNAME

Comment 158, line 970

desktop/src-tauri/installer/windows.nsi:970

; Skip creating shortcut if in update mode or no shortcut mode

Comment 159, line 971

desktop/src-tauri/installer/windows.nsi:971

; but always create if migrating from wix