blog Pet Peeves: XDG Base Directory

Tags:
linux macos petpeeves

The XDG Base Directory Specification was first published in 2003 as version 0.6 . There were minor updates in 2010 with 0.7 and in 2021 with 0.8 . While applications that pre-date the specification do not annoy me so much, newer applications that ignore it are a specific pet peeve of mine.

While this specification typically only applies to Linux, many MacOS utilities are cross platform and could easily adopt the same standard, or use some of the MacOS locations. Instead, we have many, many, many, applications that think they are important enough to claim ~/.appname for their configuration. Doing a ls -a ~ on my current machine, and I can see many folders that are doing their own thing.

While the configuration is enough of an annoyance, it seems like applications that do not follow XDG are also likely to mix various cache data and application data in ways that make it more annoying to backup configuration and ignore temporary files.

While it would not typically be covered by a desktop specification, I feel like the explosion of .toolname files and folders in our source repositories are a similar symptom. Ideally the root of our repository should be a README, src, and docs folder. Instead many projects have dozens and dozens of .folders because each tool thinks they’re important to claim root namespace.

While I am not going to hold my breath, I do hope that more developers could learn about XDG and other existing specifications and follow them for future projects. Even better if projects would like to be a good citizen and migrate their old locations to XDG locations. The Arch Wiki has a nice summary that is quick to understand the basics.