Skip to content

fix(desktop): use filesystem-friendly userData directory name#607

Merged
t3dotgg merged 1 commit intopingdotgg:mainfrom
binbandit:fix/linux-config-dir-name
Mar 9, 2026
Merged

fix(desktop): use filesystem-friendly userData directory name#607
t3dotgg merged 1 commit intopingdotgg:mainfrom
binbandit:fix/linux-config-dir-name

Conversation

@binbandit
Copy link
Contributor

@binbandit binbandit commented Mar 9, 2026

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 usesproductName 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.

Electron derives the userData path from productName in package.json,
which produces directories with spaces and parentheses on all platforms
(e.g. ~/.config/T3 Code (Alpha) on Linux). This is hostile to shell
usage and violates Linux XDG naming conventions.

Override the userData path via app.setPath() before the ready event to
use a clean lowercase name (t3code). If the legacy directory already
exists it is used as-is so existing users keep their Chromium profile
data (localStorage, cookies, sessions, cache).

This follows the same pattern VS Code uses — keeping productName for
display purposes while explicitly setting the data directory path.

Closes pingdotgg#578
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 328eb8e8-bdf3-4a43-8cc8-e93c8b9465b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@chuks-qua
Copy link
Contributor

i was about to make a pr for this, thanks

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 9, 2026
@t3dotgg t3dotgg merged commit 4088b7a into pingdotgg:main Mar 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not a greatest choice of config directory name

4 participants