Summary#
- Override Electron's
userData directory path to use a clean, lowercase name (t3code) instead of the productName-derived T3 Code (Alpha).
- Existing users with the legacy directory are automatically detected and continue using it — no data loss.
Closes #578
Problem#
Electron derives the userData path from productName in package.json. With "T3 Code (Alpha)" this produces:
| Platform | Path |
|---|
| Linux | ~/.config/T3 Code (Alpha)/ |
| macOS | ~/Library/Application Support/T3 Code (Alpha)/ |
| Windows | %APPDATA%/T3 Code (Alpha)/ |
Spaces and parentheses in directory names are hostile to shell usage and violate Linux XDG naming conventions.
Solution#
Call app.setPath("userData", ...) synchronously at the top level (before Electron's ready event) to override the path with a clean name. This is the same pattern VS Code uses — productName stays as-is for display purposes (window titles, About panel) while the data directory gets an explicit filesystem-friendly path.
New users get ~/.config/t3code/ (or platform equivalent).
Existing users are detected via fs.existsSync on the legacy path. If the old directory exists, it is used as-is so Chromium profile data (localStorage, cookies, sessions, cache) is preserved.
The userData directory is purely for Electron/Chromium internals — T3 Code's own state directory (~/.t3/userdata) is unaffected.
Changes#
apps/desktop/src/main.ts: Add resolveUserDataPath() function + app.setPath("userData", ...) call (+35 lines)
Note
Set Electron desktop app userData path to a filesystem-friendly directory at startup to preserve legacy data when present#
Add resolveUserDataPath to compute platform-specific app data paths and call app.setPath("userData", resolveUserDataPath()) in main.ts to prefer a legacy Electron productName directory if it exists, otherwise use a sanitized lowercase directory.
📍Where to Start#
Start with the resolveUserDataPath function and its invocation before app.whenReady() in main.ts.
Macroscope summarized 81a5efe.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
328eb8e8-bdf3-4a43-8cc8-e93c8b9465b8You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share