Skip to content

installer: find userData by package name too, delete long paths; recover a half-removed env - #18

Merged
CSSFrancis merged 2 commits into
mainfrom
fix/installer-userdata-dir
Oct 14, 2026
Merged

CSSFrancis merged 2 commits into
mainfrom
fix/installer-userdata-dir

Conversation

@CSSFrancis

@CSSFrancis CSSFrancis commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Three bugs found by running Ground Crew's real NSIS installer (directelectron/de_ground_crew#542). Two are in installer.nsh, which had never been run, and one is in pythonEnv.

1. The uninstaller and the update sweep looked in the wrong userData folder

Electron names userData after package.json's productName, and falls back to its name. GC sets productName only in electron-builder.yml, so its userData is %APPDATA%\de-groundcrew. installer.nsh used ${APP_FILENAME}, which is Ground Crew. As a result:

  • the uninstaller never offered to remove the Python environment;
  • the install/update sweep could not see a stray sidecar (its python-env / python processes).

Both now check ${APP_PACKAGE_NAME} and ${PRODUCT_NAME}. Both belong to the app, so a sibling app's data is still out of reach.

2. "Yes, remove it" left files behind

NSIS's RMDir /r stops at MAX_PATH. jupyterlab-widgets puts 330-character paths in the env and in the uv cache, so 17 files (3.5 MB) survived. The macro now runs rd /s /q "\?\…" first, and RMDir catches anything left.

3. A half-removed env bricked the next install

What #2 left behind is a python-env with no pyvenv.cfg. uv refuses that directory ("cannot be used because it is not a valid Python environment"), so after a reinstall GC sat on the env-setup error on every launch. resolvePythonEnv now clears such a directory before setup (clearBrokenEnv). The directory is the shell's own. The same state can also come from a crash mid-delete.

Tested (Windows, GC installer built against this branch, NVIDIA GPU)

  • Recovery: installed over the app stuck on the broken env. The installer closed it; on relaunch the leftover was cleared and the GPU env rebuilt online in 163 s.
  • Uninstall answering Yes, with the app running: the prompt appeared; all 8 app and sidecar processes were closed; python-env, uv-cache, python, requirements.offline.txt and wheelhouse were all removed; settings, logs and Chromium data were kept.
  • Also re-checked on this build: silent install; reinstall over a running app (env untouched); silent uninstall (env kept, the /SD IDNO default).
  • Unit tests: clearBrokenEnv against a past-MAX_PATH leftover, a real venv and a missing dir. 175 pass, and the typecheck is clean.

…ver a half-removed env

Electron names userData after package.json's productName, else its name; an
app that sets productName only in electron-builder.yml (Ground Crew) gets
%APPDATA%\de-groundcrew while APP_FILENAME is "Ground Crew". installer.nsh
looked only at APP_FILENAME, so the uninstaller never offered to remove the env
and the update sweep could not see a stray sidecar. It now checks
APP_PACKAGE_NAME and PRODUCT_NAME.

NSIS's RMDir stops at MAX_PATH, and jupyterlab-widgets puts 330-character paths
in the env and the uv cache, so a Yes left 17 files behind. `rd \?\` goes first.

A python-env without pyvenv.cfg (what that left) made uv refuse the directory,
so every later launch failed at env setup. resolvePythonEnv clears it first.

Claude-Session: https://claude.ai/code/session_01H5iXTCbhcT5B6PHa6QD743
@CSSFrancis
CSSFrancis merged commit 957ecac into main Oct 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant