mac-cleanup / mac-cleanup-py

👨‍💻 Python cleanup script for macOS
Apache License 2.0
1.7k stars 66 forks source link

Align Configuration File Path with XDG Base Directory Specification #190

Closed a322655 closed 2 months ago

a322655 commented 4 months ago

Is your feature request related to a problem?

The configuration file for mac-cleanup-py is currently stored at ~/.mac_cleanup_py, rather than in the directory specified by $XDG_CONFIG_HOME as recommended by the XDG Base Directory Specification. This practice clutters the home directory and does not comply with the common Unix ecosystem standards.

Describe the solution you'd like

To comply with the XDG Base Directory Specification, store the mac-cleanup-py configuration file in $XDG_CONFIG_HOME/mac-clean-up/mac_cleanup_py on macOS. This adjustment will keep the home directory tidy and make managing dotfiles easier.

Describe alternatives you've considered

One alternative is to add an interactive setting that lets users specify a custom configuration file path, enabling them to choose the desired location manually.

Additional Context

Following the XDG Base Directory Specification improves user experience by standardizing where configuration files are stored. This is particularly useful for users managing configurations across multiple systems with a bare dotfiles git repo. Below is the current code snippet from main.py that needs adjustment:

class EntryPoint:
    config_path = Path.home().joinpath(".mac_cleanup_py")

The program should first check if the environment variable $XDG_CONFIG_HOME is set. If it is, store the configuration in $XDG_CONFIG_HOME/mac-cleanup-py/mac_cleanup_py. If not, use~/.config/mac-cleanup-py/mac_cleanup_py since~/.config is the default for $XDG_CONFIG_HOME. Create the directory path if it doesn't exist.

github-actions[bot] commented 4 months ago

👋🏻 Thank you for your feedback, gonna watch it soon

efa2d19 commented 2 months ago

added XDG_CONFIG_HOME support in dceedf3