Skip to content

Commit

Permalink
Merge pull request #419 from ericpre/fix_default_installation_folder_…
Browse files Browse the repository at this point in the history
…all_users

Fix default installation folder all users
  • Loading branch information
mcg1969 authored Nov 30, 2020
2 parents c1d6e83 + 545432f commit cbab5d9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
13 changes: 11 additions & 2 deletions CONSTRUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ and must be a `.bat` file.
_required:_ no<br/>
_type:_ string<br/>
Set default install prefix. On Linux, if not provided, the default prefix is
`${HOME}/${NAME}`. On windows, if not provided, the default prefix is
`${USERPROFILE}\${NAME}`.
`${HOME}/${NAME}`. On windows, this is used only for "Just Me" installation;
for "All Users" installation, use the `default_prefix_all_users` key.
If not provided, the default prefix is `${USERPROFILE}\${NAME}`.

## `default_prefix_domain_user`

Expand All @@ -296,6 +297,14 @@ installation prefix for domain user will be `${LOCALAPPDATA}\${NAME}`.
By default, it is different from the `default_prefix` value to avoid installing
the distribution in the roaming profile. Windows only.

## `default_prefix_all_users`

_required:_ no<br/>
_type:_ string<br/>
Set default installation prefix for All Users installation. If not provided,
the installation prefix for all users installation will be
`${ALLUSERSPROFILE}\${NAME}`. Windows only.

## `welcome_image`

_required:_ no<br/>
Expand Down
11 changes: 9 additions & 2 deletions constructor/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,22 @@

('default_prefix', False, str, '''
Set default install prefix. On Linux, if not provided, the default prefix is
`${HOME}/${NAME}`. On windows, if not provided, the default prefix is
`${USERPROFILE}\${NAME}`.
`${HOME}/${NAME}`. On windows, this is used only for "Just Me" installation;
for "All Users" installation, use the `default_prefix_all_users` key.
If not provided, the default prefix is `${USERPROFILE}\${NAME}`.
'''),

('default_prefix_domain_user', False, str, '''
Set default installation prefix for domain user. If not provided, the
installation prefix for domain user will be `${LOCALAPPDATA}\${NAME}`.
By default, it is different from the `default_prefix` value to avoid installing
the distribution in the roaming profile. Windows only.
'''),

('default_prefix_all_users', False, str, '''
Set default installation prefix for All Users installation. If not provided,
the installation prefix for all users installation will be
`${ALLUSERSPROFILE}\${NAME}`. Windows only.
'''),

('welcome_image', False, str, '''
Expand Down
9 changes: 5 additions & 4 deletions constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Unicode "true"
!define PYVERSION_MAJOR __PYVERSION_MAJOR__
!define DEFAULT_PREFIX __DEFAULT_PREFIX__
!define DEFAULT_PREFIX_DOMAIN_USER __DEFAULT_PREFIX_DOMAIN_USER__
!define DEFAULT_PREFIX_ALL_USERS __DEFAULT_PREFIX_ALL_USERS__
!define POST_INSTALL_DESC __POST_INSTALL_DESC__
!define PRODUCT_NAME "${NAME} ${VERSION} (${ARCH})"
!define UNINSTALL_NAME "@UNINSTALL_NAME@"
Expand All @@ -39,8 +40,6 @@ Unicode "true"

var /global INSTDIR_JUSTME

!define INSTDIR_ALLUSERS "$%ALLUSERSPROFILE%\${NAME}"

# UAC shield overlay
!ifndef BCM_SETSHIELD
!define BCM_SETSHIELD 0x0000160C
Expand Down Expand Up @@ -363,7 +362,8 @@ Function InstModeChanged
${Else}
SetShellVarContext All
${IfNot} ${Silent}
StrCpy $INSTDIR ${INSTDIR_ALLUSERS}
ExpandEnvStrings $0 ${DEFAULT_PREFIX_ALL_USERS}
StrCpy $INSTDIR $0
${Endif}
${EndIf}
Pop $0
Expand Down Expand Up @@ -526,7 +526,8 @@ Function .onInit
; /D was not used, add default based on install type
${If} $InstDir == ""
${If} $InstMode == ${ALL_USERS}
strcpy $INSTDIR ${INSTDIR_ALLUSERS}
ExpandEnvStrings $0 ${DEFAULT_PREFIX_ALL_USERS}
StrCpy $INSTDIR $0
${Else}
strcpy $INSTDIR $INSTDIR_JUSTME
${EndIf}
Expand Down
3 changes: 3 additions & 0 deletions constructor/winexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def make_nsi(info, dir_path):
'DEFAULT_PREFIX': info.get('default_prefix', join('%USERPROFILE%', name.lower())),
'DEFAULT_PREFIX_DOMAIN_USER': info.get('default_prefix_domain_user',
join('%LOCALAPPDATA%', name.lower())),
'DEFAULT_PREFIX_ALL_USERS': info.get('default_prefix_all_users',
join('%ALLUSERSPROFILE%', name.lower())),

'POST_INSTALL_DESC': info['post_install_desc'],
'OUTFILE': info['_outpath'],
'VIPV': make_VIProductVersion(info['version']),
Expand Down

0 comments on commit cbab5d9

Please sign in to comment.