Skip to content

[2.x] feat: XDG directory standard#8769

Merged
eed3si9n merged 2 commits intosbt:developfrom
bitloi:feature/3681-xdg-directory-standard
Feb 21, 2026
Merged

[2.x] feat: XDG directory standard#8769
eed3si9n merged 2 commits intosbt:developfrom
bitloi:feature/3681-xdg-directory-standard

Conversation

@bitloi
Copy link
Copy Markdown
Contributor

@bitloi bitloi commented Feb 20, 2026

Summary

When SBT_CONFIG_HOME, XDG_CONFIG_HOME (Unix), or LOCALAPPDATA (Windows) is set, sbt uses that for the default global config directory instead of ~/.sbt. Existing users with no env set keep ~/.sbt. No new dependencies.

Reproduction / verification

  1. Unix: XDG_CONFIG_HOME=/tmp/myconfig sbt -v compile → command line includes -Dsbt.global.base=/tmp/myconfig/sbt.
  2. Override: sbt --sbt-dir ~/.sbt ... or -Dsbt.global.base=... still wins.
  3. Unit: mainProj/Test/testOnly sbt.BuildPathsTest (property + absolute path).
  4. Integration: launcherPackageIntegrationTest/Test/test (script XDG test included).

Closes #3681

…config

- Add SysProp.defaultGlobalBaseDirectory: uses SBT_CONFIG_HOME,
  XDG_CONFIG_HOME/sbt (Unix), LOCALAPPDATA/sbt (Windows), else ~/.sbt
- BuildPaths.defaultGlobalBase delegates to SysProp for consistent default
- sbt script: inject -Dsbt.global.base from XDG when not already set;
  getPreloaded() fallback uses SBT_CONFIG_HOME/XDG_CONFIG_HOME
- sbt.bat: use LOCALAPPDATA/sbt when --sbt-dir not set
- Tests: BuildPathsTest (property + absolute path), RunnerScriptTest (XDG)
@bitloi bitloi changed the title Feature/3681 xdg directory standard feat/3681 xdg directory standard Feb 20, 2026
@bitloi bitloi changed the title feat/3681 xdg directory standard feat/xdg directory standard Feb 20, 2026
@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Feb 20, 2026

@eed3si9n Ready for review.

@eed3si9n eed3si9n changed the title feat/xdg directory standard [2.x] feat: XDG directory standard Feb 21, 2026
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The change looks great.

@eed3si9n eed3si9n merged commit c6f67d7 into sbt:develop Feb 21, 2026
15 checks passed
@soc soc mentioned this pull request Feb 21, 2026
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.

Directory standard

2 participants