Skip to content

feat(config): add XDG Base Directory support for config path#1

Open
Xm798 wants to merge 1 commit intolinhan-dev:mainfrom
Xm798:main
Open

feat(config): add XDG Base Directory support for config path#1
Xm798 wants to merge 1 commit intolinhan-dev:mainfrom
Xm798:main

Conversation

@Xm798
Copy link

@Xm798 Xm798 commented Feb 27, 2026

Summary

Add XDG Base Directory Specification support for config file location.

Changes

  • GetConfigDir() now checks $XDG_CONFIG_HOME/envpick/ when set and ~/.envpick/ doesn't exist
  • Defaults to ~/.envpick/ for backward compatibility with existing installs
  • Added unit tests for all config dir resolution paths
  • Updated e2e test helpers to clear XDG_CONFIG_HOME for proper isolation
  • Updated README (EN/CN) to document the XDG path option

Behavior

Condition Config path
~/.envpick/ exists ~/.envpick/ (backward compat)
$XDG_CONFIG_HOME set, no ~/.envpick/ $XDG_CONFIG_HOME/envpick/
Neither ~/.envpick/

- Use $XDG_CONFIG_HOME/envpick/ when set and ~/.envpick/ doesn't exist
- Default to ~/.envpick/ for backward compatibility
- Clear XDG_CONFIG_HOME in e2e test isolation to prevent env leakage
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