Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ Function SkipPageIfUACInnerInstance
${EndIf}
FunctionEnd

Function InitializeVariables
StrCpy $CheckPathLength "{{ 1 if check_path_length else 0 }}"
StrCpy $ARGV_NoRegistry "0"
StrCpy $ARGV_KeepPkgCache "{{ 1 if keep_pkgs else 0 }}"

# Package cache option
StrCpy $Ana_ClearPkgCache_State {{ '${BST_UNCHECKED}' if keep_pkgs else '${BST_CHECKED}' }}

# Pre/post install
StrCpy $Ana_PreInstall_State {{ '${BST_CHECKED}' if pre_install_exists else '${BST_UNCHECKED}' }}
StrCpy $Ana_PostInstall_State {{ '${BST_CHECKED}' if post_install_exists else '${BST_UNCHECKED}' }}
FunctionEnd

!macro DoElevation
GetDlgItem $1 $HWNDParent 1
System::Call user32::GetFocus()i.s
Expand Down Expand Up @@ -322,7 +335,7 @@ FunctionEnd
/NoRegistry=[0|1] [default: AllUsers: 0, JustMe: 0]$\n\
/NoScripts=[0|1] [default: 0]$\n\
/NoShortcuts=[0|1] [default: 0]$\n\
/CheckPathLength=[0|1] [default: 1]$\n\
/CheckPathLength=[0|1] [default: {{ 1 if check_path_length else 0 }}]$\n\
/? (show this help message)$\n\
/S (run in CLI/headless mode)$\n\
/Q (quiet mode, do not print output to console)$\n\
Expand Down Expand Up @@ -412,15 +425,9 @@ FunctionEnd

ClearErrors
${GetOptions} $ARGV "/KeepPkgCache=" $ARGV_KeepPkgCache
${If} ${Errors}
StrCpy $ARGV_KeepPkgCache "{{ 1 if keep_pkgs else 0 }}"
${EndIf}

ClearErrors
${GetOptions} $ARGV "/NoRegistry=" $ARGV_NoRegistry
${If} ${Errors}
StrCpy $ARGV_NoRegistry "0"
${EndIf}

ClearErrors
${GetOptions} $ARGV "/NoScripts=" $ARGV_NoScripts
Expand Down Expand Up @@ -605,8 +612,9 @@ Function .onInit
Push $R1
Push $R2

# 1. Initialize core options default values
# 1. Initialize core options default values and other variables
Call mui_AnaCustomOptions_InitDefaults
Call InitializeVariables

# 2. Account finally for CLI to potentially override core default values
${If} ${Silent}
Expand Down Expand Up @@ -751,16 +759,6 @@ Function .onInit
${EndIf}
${EndIf}

; Set default value
${If} $CheckPathLength == ""
StrCpy $CheckPathLength "1"
${EndIf}

StrCpy $CheckPathLength "{{ 1 if check_path_length else 0 }}"
Comment on lines -754 to -759
Copy link
Contributor Author

@lrandersson lrandersson Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed we set CheckPathLength to 1 if it is not set, and then we set it to either 0 or 1. Seems odd? The documentation also says default is False for Windows regarding check_path_length, let me know what you think we should do here.

Note that I moved this code up to Function InitializeVariables and removed the "if empty set to 1" part.

Then in cli-options.md it says:

- `/CheckPathLength=[0|1]`: Check whether the installation path is too long (>46
  characters). The default depends on how the installer was created.

which I think looks like it is now with the changes in this PR.

StrCpy $Ana_ClearPkgCache_State {{ '${BST_UNCHECKED}' if keep_pkgs else '${BST_CHECKED}' }}
StrCpy $Ana_PreInstall_State {{ '${BST_CHECKED}' if pre_install_exists else '${BST_UNCHECKED}' }}
StrCpy $Ana_PostInstall_State {{ '${BST_CHECKED}' if post_install_exists else '${BST_UNCHECKED}' }}

${Print} "Welcome to ${NAME} ${VERSION}$\n"

Pop $R2
Expand Down
19 changes: 19 additions & 0 deletions news/1124-assign-uninitialized-variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* EXE: Fix a regression with uninitialized variables that prevented installations from being added to the "Add/Remove Programs" list. (#1124)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Loading