app-builder-lib 26.0.18 → 26.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/out/codeSign/macCodeSign.js +5 -1
  2. package/out/codeSign/macCodeSign.js.map +1 -1
  3. package/out/codeSign/windowsCodeSign.js +17 -12
  4. package/out/codeSign/windowsCodeSign.js.map +1 -1
  5. package/out/codeSign/windowsSignToolManager.js +13 -8
  6. package/out/codeSign/windowsSignToolManager.js.map +1 -1
  7. package/out/node-module-collector/index.d.ts +6 -4
  8. package/out/node-module-collector/index.js +22 -20
  9. package/out/node-module-collector/index.js.map +1 -1
  10. package/out/node-module-collector/nodeModulesCollector.d.ts +5 -1
  11. package/out/node-module-collector/nodeModulesCollector.js +91 -7
  12. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  13. package/out/node-module-collector/npmNodeModulesCollector.d.ts +0 -1
  14. package/out/node-module-collector/npmNodeModulesCollector.js +2 -2
  15. package/out/node-module-collector/npmNodeModulesCollector.js.map +1 -1
  16. package/out/node-module-collector/packageManager.d.ts +2 -2
  17. package/out/node-module-collector/packageManager.js +21 -16
  18. package/out/node-module-collector/packageManager.js.map +1 -1
  19. package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +1 -1
  20. package/out/node-module-collector/pnpmNodeModulesCollector.js +8 -2
  21. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  22. package/out/node-module-collector/yarnNodeModulesCollector.d.ts +0 -1
  23. package/out/node-module-collector/yarnNodeModulesCollector.js +4 -3
  24. package/out/node-module-collector/yarnNodeModulesCollector.js.map +1 -1
  25. package/out/publish/PublishManager.js +1 -1
  26. package/out/publish/PublishManager.js.map +1 -1
  27. package/out/util/appFileCopier.js +3 -2
  28. package/out/util/appFileCopier.js.map +1 -1
  29. package/out/util/yarn.js +2 -2
  30. package/out/util/yarn.js.map +1 -1
  31. package/out/version.d.ts +1 -1
  32. package/out/version.js +1 -1
  33. package/out/version.js.map +1 -1
  34. package/package.json +8 -8
  35. package/scheme.json +146 -0
  36. package/templates/linux/apparmor-profile.tpl +1 -1
  37. package/templates/nsis/include/FileAssociation.nsh +4 -13
  38. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +70 -24
  39. package/templates/nsis/multiUser.nsh +43 -2
package/scheme.json CHANGED
@@ -7,6 +7,9 @@
7
7
  {
8
8
  "$ref": "#/definitions/GithubOptions"
9
9
  },
10
+ {
11
+ "$ref": "#/definitions/GitlabOptions"
12
+ },
10
13
  {
11
14
  "$ref": "#/definitions/S3Options"
12
15
  },
@@ -108,6 +111,9 @@
108
111
  {
109
112
  "$ref": "#/definitions/GithubOptions"
110
113
  },
114
+ {
115
+ "$ref": "#/definitions/GitlabOptions"
116
+ },
111
117
  {
112
118
  "$ref": "#/definitions/S3Options"
113
119
  },
@@ -256,6 +262,9 @@
256
262
  {
257
263
  "$ref": "#/definitions/GithubOptions"
258
264
  },
265
+ {
266
+ "$ref": "#/definitions/GitlabOptions"
267
+ },
259
268
  {
260
269
  "$ref": "#/definitions/S3Options"
261
270
  },
@@ -732,6 +741,9 @@
732
741
  {
733
742
  "$ref": "#/definitions/GithubOptions"
734
743
  },
744
+ {
745
+ "$ref": "#/definitions/GitlabOptions"
746
+ },
735
747
  {
736
748
  "$ref": "#/definitions/S3Options"
737
749
  },
@@ -911,6 +923,9 @@
911
923
  {
912
924
  "$ref": "#/definitions/GithubOptions"
913
925
  },
926
+ {
927
+ "$ref": "#/definitions/GitlabOptions"
928
+ },
914
929
  {
915
930
  "$ref": "#/definitions/S3Options"
916
931
  },
@@ -1270,6 +1285,9 @@
1270
1285
  {
1271
1286
  "$ref": "#/definitions/GithubOptions"
1272
1287
  },
1288
+ {
1289
+ "$ref": "#/definitions/GitlabOptions"
1290
+ },
1273
1291
  {
1274
1292
  "$ref": "#/definitions/S3Options"
1275
1293
  },
@@ -1560,6 +1578,10 @@
1560
1578
  "$ref": "#/definitions/OutgoingHttpHeaders",
1561
1579
  "description": "Any custom request headers"
1562
1580
  },
1581
+ "tagNamePrefix": {
1582
+ "description": "If defined, sets the prefix of the tag name that comes before the semver number.\ne.g. \"v\" in \"v1.2.3\" or \"test\" of \"test1.2.3\".\nOverrides `vPrefixedTagName`",
1583
+ "type": "string"
1584
+ },
1563
1585
  "timeout": {
1564
1586
  "default": 120000,
1565
1587
  "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)",
@@ -1592,6 +1614,88 @@
1592
1614
  ],
1593
1615
  "type": "object"
1594
1616
  },
1617
+ "GitlabOptions": {
1618
+ "additionalProperties": false,
1619
+ "description": "[GitLab](https://docs.gitlab.com/ee/user/project/releases/) options.\n\nGitLab [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) is required for private repositories. You can generate one by going to your GitLab profile settings.\nDefine `GITLAB_TOKEN` environment variable.",
1620
+ "properties": {
1621
+ "channel": {
1622
+ "default": "latest",
1623
+ "description": "The channel.",
1624
+ "type": [
1625
+ "null",
1626
+ "string"
1627
+ ]
1628
+ },
1629
+ "host": {
1630
+ "default": "gitlab.com",
1631
+ "description": "The host (including the port if needed).",
1632
+ "type": [
1633
+ "null",
1634
+ "string"
1635
+ ]
1636
+ },
1637
+ "projectId": {
1638
+ "description": "The GitLab project ID or namespace/project-name.",
1639
+ "type": [
1640
+ "string",
1641
+ "number"
1642
+ ]
1643
+ },
1644
+ "provider": {
1645
+ "const": "gitlab",
1646
+ "description": "The provider. Must be `gitlab`.",
1647
+ "type": "string"
1648
+ },
1649
+ "publishAutoUpdate": {
1650
+ "default": true,
1651
+ "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.",
1652
+ "type": "boolean"
1653
+ },
1654
+ "publisherName": {
1655
+ "anyOf": [
1656
+ {
1657
+ "items": {
1658
+ "type": "string"
1659
+ },
1660
+ "type": "array"
1661
+ },
1662
+ {
1663
+ "type": "null"
1664
+ }
1665
+ ]
1666
+ },
1667
+ "requestHeaders": {
1668
+ "$ref": "#/definitions/OutgoingHttpHeaders",
1669
+ "description": "Any custom request headers"
1670
+ },
1671
+ "timeout": {
1672
+ "default": 120000,
1673
+ "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)",
1674
+ "type": [
1675
+ "null",
1676
+ "number"
1677
+ ]
1678
+ },
1679
+ "token": {
1680
+ "description": "The access token to support auto-update from private GitLab repositories. Never specify it in the configuration files. Only for [setFeedURL](./auto-update.md#appupdatersetfeedurloptions).",
1681
+ "type": [
1682
+ "null",
1683
+ "string"
1684
+ ]
1685
+ },
1686
+ "updaterCacheDirName": {
1687
+ "type": [
1688
+ "null",
1689
+ "string"
1690
+ ]
1691
+ }
1692
+ },
1693
+ "required": [
1694
+ "projectId",
1695
+ "provider"
1696
+ ],
1697
+ "type": "object"
1698
+ },
1595
1699
  "KeygenOptions": {
1596
1700
  "additionalProperties": false,
1597
1701
  "description": "Keygen options.\nhttps://keygen.sh/\nDefine `KEYGEN_TOKEN` environment variable.",
@@ -2001,6 +2105,9 @@
2001
2105
  {
2002
2106
  "$ref": "#/definitions/GithubOptions"
2003
2107
  },
2108
+ {
2109
+ "$ref": "#/definitions/GitlabOptions"
2110
+ },
2004
2111
  {
2005
2112
  "$ref": "#/definitions/S3Options"
2006
2113
  },
@@ -2273,6 +2380,9 @@
2273
2380
  {
2274
2381
  "$ref": "#/definitions/GithubOptions"
2275
2382
  },
2383
+ {
2384
+ "$ref": "#/definitions/GitlabOptions"
2385
+ },
2276
2386
  {
2277
2387
  "$ref": "#/definitions/S3Options"
2278
2388
  },
@@ -2778,6 +2888,9 @@
2778
2888
  {
2779
2889
  "$ref": "#/definitions/GithubOptions"
2780
2890
  },
2891
+ {
2892
+ "$ref": "#/definitions/GitlabOptions"
2893
+ },
2781
2894
  {
2782
2895
  "$ref": "#/definitions/S3Options"
2783
2896
  },
@@ -3410,6 +3523,9 @@
3410
3523
  {
3411
3524
  "$ref": "#/definitions/GithubOptions"
3412
3525
  },
3526
+ {
3527
+ "$ref": "#/definitions/GitlabOptions"
3528
+ },
3413
3529
  {
3414
3530
  "$ref": "#/definitions/S3Options"
3415
3531
  },
@@ -3692,6 +3808,9 @@
3692
3808
  {
3693
3809
  "$ref": "#/definitions/GithubOptions"
3694
3810
  },
3811
+ {
3812
+ "$ref": "#/definitions/GitlabOptions"
3813
+ },
3695
3814
  {
3696
3815
  "$ref": "#/definitions/S3Options"
3697
3816
  },
@@ -3818,6 +3937,9 @@
3818
3937
  {
3819
3938
  "$ref": "#/definitions/GithubOptions"
3820
3939
  },
3940
+ {
3941
+ "$ref": "#/definitions/GitlabOptions"
3942
+ },
3821
3943
  {
3822
3944
  "$ref": "#/definitions/S3Options"
3823
3945
  },
@@ -4095,6 +4217,9 @@
4095
4217
  {
4096
4218
  "$ref": "#/definitions/GithubOptions"
4097
4219
  },
4220
+ {
4221
+ "$ref": "#/definitions/GitlabOptions"
4222
+ },
4098
4223
  {
4099
4224
  "$ref": "#/definitions/S3Options"
4100
4225
  },
@@ -4443,6 +4568,9 @@
4443
4568
  {
4444
4569
  "$ref": "#/definitions/GithubOptions"
4445
4570
  },
4571
+ {
4572
+ "$ref": "#/definitions/GitlabOptions"
4573
+ },
4446
4574
  {
4447
4575
  "$ref": "#/definitions/S3Options"
4448
4576
  },
@@ -5194,6 +5322,9 @@
5194
5322
  {
5195
5323
  "$ref": "#/definitions/GithubOptions"
5196
5324
  },
5325
+ {
5326
+ "$ref": "#/definitions/GitlabOptions"
5327
+ },
5197
5328
  {
5198
5329
  "$ref": "#/definitions/S3Options"
5199
5330
  },
@@ -5310,6 +5441,9 @@
5310
5441
  {
5311
5442
  "$ref": "#/definitions/GithubOptions"
5312
5443
  },
5444
+ {
5445
+ "$ref": "#/definitions/GitlabOptions"
5446
+ },
5313
5447
  {
5314
5448
  "$ref": "#/definitions/S3Options"
5315
5449
  },
@@ -5867,6 +6001,9 @@
5867
6001
  {
5868
6002
  "$ref": "#/definitions/GithubOptions"
5869
6003
  },
6004
+ {
6005
+ "$ref": "#/definitions/GitlabOptions"
6006
+ },
5870
6007
  {
5871
6008
  "$ref": "#/definitions/S3Options"
5872
6009
  },
@@ -6177,6 +6314,9 @@
6177
6314
  {
6178
6315
  "$ref": "#/definitions/GithubOptions"
6179
6316
  },
6317
+ {
6318
+ "$ref": "#/definitions/GitlabOptions"
6319
+ },
6180
6320
  {
6181
6321
  "$ref": "#/definitions/S3Options"
6182
6322
  },
@@ -6588,6 +6728,9 @@
6588
6728
  {
6589
6729
  "$ref": "#/definitions/GithubOptions"
6590
6730
  },
6731
+ {
6732
+ "$ref": "#/definitions/GitlabOptions"
6733
+ },
6591
6734
  {
6592
6735
  "$ref": "#/definitions/S3Options"
6593
6736
  },
@@ -7624,6 +7767,9 @@
7624
7767
  {
7625
7768
  "$ref": "#/definitions/GithubOptions"
7626
7769
  },
7770
+ {
7771
+ "$ref": "#/definitions/GitlabOptions"
7772
+ },
7627
7773
  {
7628
7774
  "$ref": "#/definitions/S3Options"
7629
7775
  },
@@ -1,7 +1,7 @@
1
1
  abi <abi/4.0>,
2
2
  include <tunables/global>
3
3
 
4
- profile ${executable} "/opt/${sanitizedProductName}/${executable}" flags=(unconfined) {
4
+ profile "${executable}" "/opt/${sanitizedProductName}/${executable}" flags=(unconfined) {
5
5
  userns,
6
6
 
7
7
  # Site-specific additions and overrides. See local/README for details.
@@ -63,11 +63,8 @@
63
63
  ;
64
64
 
65
65
  !macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
66
- ; Backup the previously associated file class
67
- ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
68
- WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
69
-
70
66
  WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
67
+ WriteRegNone SHELL_CONTEXT "Software\Classes\.${EXT}\OpenWithProgids" "${FILECLASS}"
71
68
 
72
69
  WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
73
70
  WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
@@ -77,11 +74,8 @@
77
74
  !macroend
78
75
 
79
76
  !macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND
80
- ; Backup the previously associated file class
81
- ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
82
- WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
83
-
84
77
  WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
78
+ WriteRegNone SHELL_CONTEXT "Software\Classes\.${EXT}\OpenWithProgids" "${FILECLASS}"
85
79
  StrCmp "${SHELLNEW}" "0" +2
86
80
  WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}\ShellNew" "NullFile" ""
87
81
 
@@ -103,10 +97,7 @@
103
97
 
104
98
 
105
99
  !macro APP_UNASSOCIATE EXT FILECLASS
106
- ; Backup the previously associated file class
107
- ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup`
108
- WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0"
109
-
100
+ DeleteRegValue SHELL_CONTEXT "Software\Classes\.${EXT}\OpenWithProgids" "${FILECLASS}"
110
101
  DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}`
111
102
  !macroend
112
103
 
@@ -129,4 +120,4 @@
129
120
  ; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
130
121
  ; can update the shell.
131
122
  System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"
132
- !macroend
123
+ !macroend
@@ -30,22 +30,77 @@
30
30
  !macroend
31
31
 
32
32
  !macro CHECK_APP_RUNNING
33
- !ifmacrodef customCheckAppRunning
34
- !insertmacro customCheckAppRunning
33
+ Var /GLOBAL CmdPath
34
+ Var /GLOBAL FindPath
35
+ Var /GLOBAL PowerShellPath
36
+ StrCpy $CmdPath "$SYSDIR\cmd.exe"
37
+ StrCpy $FindPath "$SYSDIR\find.exe"
38
+ StrCpy $PowerShellPath "$SYSDIR\WindowsPowerShell\v1.0\powershell.exe"
39
+ !ifmacrodef customCheckAppRunning
40
+ !insertmacro customCheckAppRunning
41
+ !else
42
+ !insertmacro IS_POWERSHELL_AVAILABLE
43
+ !insertmacro _CHECK_APP_RUNNING
44
+ !endif
45
+ !macroend
46
+
47
+ !macro IS_POWERSHELL_AVAILABLE
48
+ Var /GLOBAL IsPowerShellAvailable ; 0 = available, 1 = not available
49
+ # Try running PowerShell with a simple command to check if it's available
50
+ nsExec::Exec `"$PowerShellPath" -C "if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"`
51
+ Pop $0 # Return code (0 = success, other = error)
52
+
53
+ ${if} $0 == 0
54
+ # PowerShell is available, check if it's not blocked by policies
55
+ nsExec::Exec `"$PowerShellPath" -C "if ((Get-ExecutionPolicy -Scope Process) -eq 'Restricted') { exit 1 } else { exit 0 }"`
56
+ Pop $0
57
+ ${endIf}
58
+
59
+ ${if} $0 != 0
60
+ StrCpy $0 1
61
+ ${endIf}
62
+
63
+ StrCpy $IsPowerShellAvailable $0
64
+ !macroend
65
+
66
+ !macro FIND_PROCESS _FILE _RETURN
67
+ ${if} $IsPowerShellAvailable == 0
68
+ nsExec::Exec `"$PowerShellPath" -C "if ((Get-CimInstance -ClassName Win32_Process | ? {$$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')}).Count -gt 0) { exit 0 } else { exit 1 }"`
69
+ Pop ${_RETURN}
70
+ ${else}
71
+ !ifdef INSTALL_MODE_PER_ALL_USERS
72
+ ${nsProcess::FindProcess} "${_FILE}" ${_RETURN}
35
73
  !else
36
- !insertmacro _CHECK_APP_RUNNING
74
+ # find process owned by current user
75
+ nsExec::Exec `"$CmdPath" /C tasklist /FI "USERNAME eq %USERNAME%" /FI "IMAGENAME eq ${_FILE}" /FO CSV | "$FindPath" "${_FILE}"`
76
+ Pop ${_RETURN}
37
77
  !endif
78
+ ${endIf}
38
79
  !macroend
39
80
 
40
- !macro FIND_PROCESS _FILE _ERR
41
- !ifdef INSTALL_MODE_PER_ALL_USERS
42
- ${nsProcess::FindProcess} "${_FILE}" ${_ERR}
43
- !else
44
- # find process owned by current user
45
- nsExec::Exec `"$SYSDIR\cmd.exe" /c tasklist /FI "USERNAME eq %USERNAME%" /FI "IMAGENAME eq ${_FILE}" /FO csv | "$SYSDIR\find.exe" "${_FILE}"`
46
- Pop ${_ERR}
47
- !endif
48
- !macroend
81
+ !macro KILL_PROCESS _FILE _FORCE
82
+ Push $0
83
+ ${if} ${_FORCE} == 1
84
+ ${if} $IsPowerShellAvailable == 0
85
+ StrCpy $0 "-Force"
86
+ ${else}
87
+ StrCpy $0 "/F"
88
+ ${endIf}
89
+ ${else}
90
+ StrCpy $0 ""
91
+ ${endIf}
92
+
93
+ ${if} $IsPowerShellAvailable == 0
94
+ nsExec::Exec `"$PowerShellPath" -C "Get-CimInstance -ClassName Win32_Process | ? {$$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')} | % { Stop-Process -Id $$_.ProcessId $0 }"`
95
+ ${else}
96
+ !ifdef INSTALL_MODE_PER_ALL_USERS
97
+ nsExec::Exec `taskkill /IM "${_FILE}" /FI "PID ne $pid"`
98
+ !else
99
+ nsExec::Exec `"$CmdPath" /C taskkill $0 /IM "${_FILE}" /FI "PID ne $pid" /FI "USERNAME eq %USERNAME%"`
100
+ !endif
101
+ ${endIf}
102
+ Pop $0
103
+ !macroend
49
104
 
50
105
  !macro _CHECK_APP_RUNNING
51
106
  ${GetProcessInfo} 0 $pid $1 $2 $3 $4
@@ -69,12 +124,7 @@
69
124
 
70
125
  DetailPrint "$(appClosing)"
71
126
 
72
- # https://github.com/electron-userland/electron-builder/issues/2516#issuecomment-372009092
73
- !ifdef INSTALL_MODE_PER_ALL_USERS
74
- nsExec::Exec `taskkill /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"`
75
- !else
76
- nsExec::Exec `"$SYSDIR\cmd.exe" /c taskkill /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid" /fi "USERNAME eq %USERNAME%"`
77
- !endif
127
+ !insertmacro KILL_PROCESS "${APP_EXECUTABLE_FILENAME}" 0
78
128
  # to ensure that files are not "in-use"
79
129
  Sleep 300
80
130
 
@@ -88,13 +138,9 @@
88
138
  ${if} $R0 == 0
89
139
  # wait to give a chance to exit gracefully
90
140
  Sleep 1000
91
- !ifdef INSTALL_MODE_PER_ALL_USERS
92
- nsExec::Exec `taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"`
93
- !else
94
- nsExec::Exec `"$SYSDIR\cmd.exe" /c taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid" /fi "USERNAME eq %USERNAME%"`
95
- !endif
141
+ !insertmacro KILL_PROCESS "${APP_EXECUTABLE_FILENAME}" 1 # 1 = force kill
96
142
  !insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0
97
- ${If} $R0 == 0
143
+ ${if} $R0 == 0
98
144
  DetailPrint `Waiting for "${PRODUCT_NAME}" to close.`
99
145
  Sleep 2000
100
146
  ${else}
@@ -41,7 +41,7 @@ Var installMode
41
41
  ${endif}
42
42
 
43
43
  # allow /D switch to override installation path https://github.com/electron-userland/electron-builder/issues/1551
44
- ${StdUtils.GetParameter} $R0 "D" ""
44
+ !insertmacro GetDParameter $R0
45
45
  ${If} $R0 != ""
46
46
  StrCpy $INSTDIR $R0
47
47
  ${endif}
@@ -84,10 +84,51 @@ Var installMode
84
84
  ${endif}
85
85
 
86
86
  # allow /D switch to override installation path https://github.com/electron-userland/electron-builder/issues/1551
87
- ${StdUtils.GetParameter} $R0 "D" ""
87
+ !insertmacro GetDParameter $R0
88
88
  ${If} $R0 != ""
89
89
  StrCpy $INSTDIR $R0
90
90
  ${endif}
91
91
 
92
92
  !macroend
93
93
  !endif
94
+
95
+ # Custom function to handle /D parameter with spaces
96
+ # The /D parameter is special in NSIS - it must be the last parameter and cannot have quotes
97
+ # Use StdUtils.GetParameter to get the full command line, then parse /D= manually
98
+ !macro GetDParameter outVar
99
+ Push $R8
100
+ Push $R9
101
+ Push $R7
102
+ Push $R6
103
+ Push $R5
104
+
105
+ # Get the complete command line using StdUtils (including /D parameter)
106
+ ${StdUtils.GetAllParameters} $R8 "0"
107
+
108
+ # Initialize result
109
+ StrCpy $R9 ""
110
+
111
+ # Search for /D= or /d= using a simple loop
112
+ StrLen $R7 $R8
113
+ IntOp $R7 $R7 - 2 # Don't check last 2 characters
114
+ StrCpy $R6 0
115
+
116
+ ${Do}
117
+ StrCpy $R5 $R8 3 $R6 # Get 3 characters starting at position $R6
118
+ ${If} $R5 == "/D="
119
+ ${OrIf} $R5 == "/d="
120
+ # Found /D= or /d=, extract everything after it
121
+ IntOp $R6 $R6 + 3
122
+ StrCpy $R9 $R8 "" $R6
123
+ ${Break}
124
+ ${EndIf}
125
+ IntOp $R6 $R6 + 1
126
+ ${LoopUntil} $R6 > $R7
127
+
128
+ StrCpy ${outVar} $R9
129
+ Pop $R5
130
+ Pop $R6
131
+ Pop $R7
132
+ Pop $R9
133
+ Pop $R8
134
+ !macroend