XDG Base Directory Spec is not followed on Linux

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

MirandaStreeter
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Jan 12, 2019 10:28 pm
Contact:

XDG Base Directory Spec is not followed on Linux

Post by MirandaStreeter »

(Considering its technical nature, this is verging on a bug report. Feel free to move it if that's appropriate.)

TL;DR
Factorio currently does not follow the freedesktop $XDG spec on linux environments. Instead, it uses its own ~/.factorio directory. For future installs it should default to the XDG spec for config/data/state/etc as defined here.

What

The XDG spec (here's the link again) should have all the relevant details. The categories are cache, configuration, data, state, and runtime files. Factorio's .factorio contents are largely config and data. As an example, if something like $XDG_CONFIG_HOME isn't set (most distros don't!) the default is $HOME/.config.

There's arguably no pressing need to migrate users right away. Existing installations are fine as-is. The idea is to first check if there's an existing $HOME.factorio and if it's not present then fall back to the fancy new XDG defaults, with the idea you flip that order around one day far off in the future. And for safety you can add an override variable. I believe that aligns with what Mozilla is planning.

Why

While the ~/.factorio directory technically works, and its location is configurable, defaulting to a dot folder in the home directory has fallen out of "best practice" in favor of compartmentalized directories managed by the OS, much like other operating systems. As in, Windows' %AppData% et al. For the more Windows-oriented folks out there you can see a cross-OS comparison documented by the GO implementation here. You can also see a list of what other software has adopted the standard here.

From a user's perspective:
  • Littering the homedir with hidden dot folders is messy and hard to navigate
  • Any locations for these hidden dot folders have to be set on a per-app basis, assuming they're not hardcoded
  • Backing up, say for example, the config for all applications is considerably more difficult
Part of the point is to have sensible defaults across the entire desktop that's user-configurable. Having user definable behavior helps with backups, portable installations, and immutable setups. If a user expects their config files to be under ~/.config but an application defaults to something else (with at best a secondary path to search) then users have to manually copy things over on a per-app basis, somewhat defeating the point. When launching the game the ideal is to check for preexisting data in ~/.factorio for the legacy installs and, if not present, supply everything in the directories defined by freedesktop.org.

Beyond portability and consistency, the sheer abundance of dotfolders in a directory as central as home is often considered undesirable. A typical desktop user will end up with many dozens of them. I count 47 on my relatively fresh install of a few months now, and my partner has ~160. For those who daily drive linux it's a disorganized mess in the most central of central folders.

Image

The annoyance is common enough that major DEs have provided features to permanently hide specified dotfiles in their file navigators, even after enabling the "show hidden files" toggle! Both Nautilus and Dolphin (Gnome and KDE) allow you to use a .hidden file to mask the ones you so wish. Ultimately this is a manual workaround for the desired solution: Applications compartmentalizing things into .local and .config and such so that they're tucked away.

And outside of masking them in your file navigator there's several popular tools like boxxy and xdg-ninja. Again, these are tools designed to work around the issue.

This isn't some fringe opinion either. We can defer to the very people who are responsible for architecting these conventions: https://web.archive.org/web/20180827160 ... 58WgWwN9jp

In fairness this isn't the most pressing need. People aren't about to abandon ship over a few dotfolders. I don't expect this to be a super high priority. But this is the general direction linux directory management has been headed over the last ~20 years.

(paging @raiguard ;))
Jap2.0
Smart Inserter
Smart Inserter
Posts: 2423
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: XDG Base Directory Spec is not followed on Linux

Post by Jap2.0 »

See 30585, 62088, 74145 for previous discussion
There are 10 types of people: those who get this joke and those who don't.
Locked

Return to “Ideas and Suggestions”