Skip to content

Adhere to XDG Base Directory Specification for dotSwiftPM Location #8701

Open
@UpBra

Description

@UpBra

Description

Summary:

I would like to request that the dotSwiftPM directory location adhere to the XDG Base Directory Specification. This would improve compatibility with various environments and tools that follow this specification.

Proposed Changes:

  1. Default Location:

    • The dotSwiftPM directory should default to $XDG_CONFIG_HOME/swiftpm if the XDG_CONFIG_HOME environment variable is set.
    • If XDG_CONFIG_HOME is not set, it should fall back to the default location (e.g., ~/.config/swiftpm or `~/.swiftpm for backwards compatibility).
  2. Environment Variable Override:

    • Introduce an environment variable, such as SWIFTPM_CONFIG_DIR, that allows users to override the default directory location. This would provide flexibility for users who prefer a different setup.

Benefits:

  • Aligning with the XDG Base Directory Specification will enhance the user experience by ensuring a consistent and predictable directory structure.
  • Allowing users to override the location with an environment variable will provide greater flexibility and customization options.

Additional Context:

This change would help streamline configuration management for users who utilize multiple tools and prefer to keep their configuration files organized according to the XDG specification.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

6.1

Swift & OS version (output of swift --version && uname -a)

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0
Darwin VML-M-TX5FWM6TQN 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions