fix(paths): use XDG Base Directory for config on Linux#12255
Open
sumaiazaman wants to merge 2 commits intocontinuedev:mainfrom
Open
fix(paths): use XDG Base Directory for config on Linux#12255sumaiazaman wants to merge 2 commits intocontinuedev:mainfrom
sumaiazaman wants to merge 2 commits intocontinuedev:mainfrom
Conversation
On Linux, the default Continue global directory now follows the XDG Base Directory Specification: - $XDG_CONFIG_HOME/continue when XDG_CONFIG_HOME is set - ~/.config/continue otherwise Existing installations are not affected: if ~/.continue already exists the legacy path continues to be used, so no data is relocated without user action. macOS and Windows behaviour is unchanged. Fixes continuedev#5397
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="core/util/paths.ts">
<violation number="1" location="core/util/paths.ts:52">
P2: XDG_CONFIG_HOME is used without validating empty/relative values, so Linux config can be created in the working directory instead of the user config dir.</violation>
<violation number="2" location="core/util/paths.ts:53">
P2: Linux now defaults to a nested config directory, but the directory creation code still uses non-recursive `fs.mkdirSync`, which can throw when parent directories are missing.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
Two issues flagged in code review:
1. XDG_CONFIG_HOME was used without validation. An empty string or
relative path would place the config directory in the working
directory instead of the user config dir. Now only non-empty
absolute paths are accepted; anything else falls back to
~/.config.
2. getContinueGlobalPath used fs.mkdirSync without { recursive: true }.
On a fresh Linux install ~/.config may not exist yet, causing a
ENOENT crash when the XDG path is first created. Switching to
recursive mode creates all missing parent directories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5397.
On Linux, most distributions expect user configuration to live in
~/.config/(or$XDG_CONFIG_HOME) rather than directly in the home directory.This change makes Continue follow the XDG Base Directory Specification on Linux:
XDG_CONFIG_HOMEis set$XDG_CONFIG_HOME/continueXDG_CONFIG_HOMEis not set~/.config/continue~/.continuealready exists (existing install)~/.continue← unchangedmacOS and Windows behaviour is unchanged — they continue using
~/.continue.Backward compatibility
Existing Linux users with a
~/.continuedirectory are not affected — the legacy path is detected at startup and used as-is. No data is moved without user action.New Linux installations will automatically get the XDG-compliant path.
Changes
core/util/paths.ts— extractedgetDefaultContinueGlobalDir()helper that encapsulates the platform/XDG logic, wired intoCONTINUE_GLOBAL_DIRcore/util/paths.test.ts— unit tests covering all four cases (Linux+XDG, Linux+default, Linux+legacy fallback, macOS, Windows)Summary by cubic
Switches the default config directory on Linux to follow the XDG Base Directory spec:
$XDG_CONFIG_HOME/continueor~/.config/continue. Existing~/.continueinstalls are preserved, and macOS/Windows behavior is unchanged.getDefaultContinueGlobalDirfor platform-aware paths with legacy~/.continuefallback.XDG_CONFIG_HOME(non-empty absolute only); falls back to~/.configotherwise.fs.mkdirSyncingetContinueGlobalPathto create missing parent dirs.Written for commit 65d065a. Summary will update on new commits. Review in cubic