Skip to content

[Feature]: Support an install directory outside %LOCALAPPDATA% on Windows #6403

Description

@alex-glez-felix

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I am describing a concrete problem or use case, not just a vague idea.

Area

Build, CI, or release tooling

Problem or use case

Managed corporate Windows machines commonly exclude a dedicated volume from real-time scanning so dev tooling is usable, and scan the system volume aggressively. Given the file count in #5876 — 14,687 files written at install, each a separate open/stat/scan on a cold start — the install location matters for startup cost on these machines.

T3 Code cannot target that volume. createBuildConfig in scripts/build-desktop-artifact.ts sets no nsis block, so electron-builder applies oneClick: true and allowToChangeInstallationDirectory: false, fixing the install to %LOCALAPPDATA%\Programs\....

Proposed solution

apps/desktop/resources/installer.nsh — auto-detected via getResource(this.options.include, "installer.nsh") in NsisTarget.ts, so no change to build-desktop-artifact.ts and no new config key:

!macro preInit
  ReadEnvStr $0 "T3CODE_INSTALL_DIR"
  ${if} $0 != ""
    SetRegView 64
    WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$0"
    SetRegView 32
    WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$0"
  ${endif}
!macroend

preInit runs at the top of .onInit, before multiUser.nsh reads InstallLocation to pick $INSTDIR. Unset variable means today's behavior, unchanged.

Why this matters

Unblocks installs on machines where the system volume is scanned and a dev volume is not.

Smallest useful scope

The macro above, HKCU only. No installer UI, no nsis config block.

Alternatives considered

  • Pre-seeding InstallLocation manually. Works per electron-builder's docs, but requires computing UUIDv5(appId, 50e065bc-3134-11e6-9bab-38c9862bdaf3) and a manual registry edit — not something to ask of users on a managed machine.
  • oneClick: false + allowToChangeInstallationDirectory: true. Adds installer pages for every user.
  • A junction from %LOCALAPPDATA%. Exclusions match the accessed path, so the I/O is still scanned.

Risks or tradeoffs

Takes effect on install only, not on an existing one. Per-user path only; an elevated per-machine installer would not inherit the user environment. Needs a line in the Windows install docs to be discoverable.

Examples or references

Contribution

  • I would be open to helping implement this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions