Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XDG Base Directory Specification support #7386

Merged
merged 3 commits into from Mar 3, 2024
Merged

Conversation

lordzsolt
Copy link
Contributor

Motivation:

As discussed in #6204, users would like to have a clean home directory.
And in the discussions following the merge of #3430, it seems there is a willingness to adhere to the XDG spec, and support ~/.config/swiftpm.

Modifications:

If the XDG_CONFIG_HOME environmental variable is defined, use $XDG_CONFIG_HOME/swiftpm as the root dotSwiftPM directory.

Result:

The symlinks that were previously stored in ~/.swiftpm are now stored in $XDG_CONFIG_HOME/swiftpm when this variable is defined, therefore not cluttering the home directory of users.

Closes #6204

Copy link
Member

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

We either need to use EnvironmentVariables.process() instead of ProcessInfo.processInfo.environment for improved Windows handling in the future, or exclude this logic on Windows altogether.

@MaxDesiatov
Copy link
Member

@swift-ci test

@MaxDesiatov MaxDesiatov self-assigned this Mar 3, 2024
Copy link
Member

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

Thanks!

@MaxDesiatov
Copy link
Member

@swift-ci test

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) March 3, 2024 20:11
@MaxDesiatov
Copy link
Member

@swift-ci test windows

@MaxDesiatov MaxDesiatov added the needs tests This change needs test coverage label Mar 3, 2024
@MaxDesiatov MaxDesiatov merged commit 99a65c0 into apple:main Mar 3, 2024
5 checks passed
@alichtman
Copy link

Thank you!!

@bartekpacia
Copy link

Thank you for working on this!

Will this be released in Swift 6.0, or maybe earlier?

@MaxDesiatov
Copy link
Member

5.10 has been released already. Swift 6.0 is branching off main tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

~/.swiftpm config, cache to follow the XDG base dir spec
4 participants