[Linux] Comply with the XDG directory standard

Post your ideas and suggestions how to improve the game.
Post Reply
Zok
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jul 31, 2016 7:59 pm

[Linux] Comply with the XDG directory standard

Post by Zok » Sat Aug 06, 2016 4:55 pm

Not sure if this belongs in a bug report or a suggestion, I'll post it here feel free to move it if its out of place.

On linux, the XDG Base Directory Specification[1] defines the paths inside the users home directory that should be used for different purposes. Factorio currently saves the data files in $HOME/.factorio which ends up cluttering the home directory even more than it already is or needs to be.

To comply with the standard factorio should:
* Check if $XDG_CONFIG_DIR $XDG_DATA_DIR and $XDG_CACHE_DIR environment variables are set and determine the location of the directories as defined in the standard
$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

$XDG_DATA_DIRS defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory. The directories in $XDG_DATA_DIRS should be separated with a colon ':'.

If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.

$XDG_CONFIG_DIRS defines the preference-ordered set of base directories to search for configuration files in addition to the $XDG_CONFIG_HOME base directory. The directories in $XDG_CONFIG_DIRS should be seperated with a colon ':'.

If $XDG_CONFIG_DIRS is either not set or empty, a value equal to /etc/xdg should be used.
* Once the XDG data dirs have been established factorio should place its files as follows:
o .factorio/config/* should be placed in $XDG_CONFIG_HOME/factorio/
o .factorio/temp/* should be placed in $XDG_CACHE_HOME/factorio/
o Everything else(data files, logs etc) should be placed in $XDG_DATA_HOME/factorio/

A simpler to implement but not-so-compliant alternative that a lot of steam games use is to simply put everything in $XDG_DATA_HOME/factorio/. While this technically achieves the purpose of getting the files off the home directory root, full compliance with the standard would be much better in my opinion.

[1] https://specifications.freedesktop.org/ ... atest.html

golfmiketango
Filter Inserter
Filter Inserter
Posts: 510
Joined: Fri Jan 29, 2016 2:48 am

Re: [Linux] Comply with the XDG directory standard

Post by golfmiketango » Sat Aug 06, 2016 8:10 pm

Although I really dislike some of the naming decisions that XDG has implemented this is probably a good idea. For example, I notice baloo or whatever the kde file indexer is named this week is being confused by my save files:

Code: Select all

Jul 17 18:20:19 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.ini" -> "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:20:19 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:20:19 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.tmp.ini" -> "/home/greg/factorio13/config/config.ini"
Jul 17 18:20:19 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:20:20 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/saves/_autosave2.zip" -> "/home/greg/factorio13/saves/_autosave2.bak.zip"
Jul 17 18:20:20 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:20:20 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/saves/_autosave2.tmp.zip" -> "/home/greg/factorio13/saves/_autosave2.zip"
Jul 17 18:20:20 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:22:18 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.ini" -> "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:18 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:18 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.tmp.ini" -> "/home/greg/factorio13/config/config.ini"
Jul 17 18:22:18 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:22:18 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.ini" -> "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:18 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:18 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.tmp.ini" -> "/home/greg/factorio13/config/config.ini"
Jul 17 18:22:18 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:22:19 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/saves/second_try_008.zip" -> "/home/greg/factorio13/saves/second_try_008.bak.zip"
Jul 17 18:22:19 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/saves/second_try_008.bak.zip"
Jul 17 18:22:19 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/saves/second_try_008.tmp.zip" -> "/home/greg/factorio13/saves/second_try_008.zip"
Jul 17 18:22:19 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:22:24 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.ini" -> "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:24 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:24 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.tmp.ini" -> "/home/greg/factorio13/config/config.ini"
Jul 17 18:22:24 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:22:24 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.ini" -> "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:24 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/config/config.bak.ini"
Jul 17 18:22:24 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/config/config.tmp.ini" -> "/home/greg/factorio13/config/config.ini"
Jul 17 18:22:24 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Jul 17 18:22:25 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/saves/_autosave3.zip" -> "/home/greg/factorio13/saves/_autosave3.bak.zip"
Jul 17 18:22:25 moneypit baloo_file[3100]: File moved to path which now no longer exists - "/home/greg/factorio13/saves/_autosave3.bak.zip"
Jul 17 18:22:25 moneypit baloo_file[3100]: org.kde.baloo: "/home/greg/factorio13/saves/_autosave3.tmp.zip" -> "/home/greg/factorio13/saves/_autosave3.zip"
Jul 17 18:22:25 moneypit baloo_file[3100]: org.kde.baloo: Moved without data
Of course this would mean that there would no longer be a nice consistent layout across platforms like we have now. Actually isn't there already some kind of .ini file that controls where these things go?

Zok
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jul 31, 2016 7:59 pm

Re: [Linux] Comply with the XDG directory standard

Post by Zok » Sat Aug 06, 2016 8:38 pm

golfmiketango wrote:Of course this would mean that there would no longer be a nice consistent layout across platforms like we have now.
Thats why I suggested the alternative of using $XDG_DATA_HOME for everything instead of scattering the files across the XDG directories. Would get stuff out of the way in an XDG compliant way but still keep the data directory in the same format across all platforms.

Oxyd
Factorio Staff
Factorio Staff
Posts: 1084
Joined: Thu May 07, 2015 8:42 am

Re: [Linux] Comply with the XDG directory standard

Post by Oxyd » Sun Aug 07, 2016 1:52 am

Zok wrote:Not sure if this belongs in a bug report or a suggestion, I'll post it here feel free to move it if its out of place.
Moved to Ideas and Suggestions.

betrok
Fast Inserter
Fast Inserter
Posts: 100
Joined: Wed Feb 28, 2018 12:08 pm

Re: [Linux] Comply with the XDG directory standard

Post by betrok » Wed Feb 28, 2018 12:28 pm

Up.
Not a big deal, but it is better to keep ~ clean.
Just move everything from ~/.factorio to ~/.local/share/factorio (or $XDG_DATA_HOM/factorio in case variable is set) will be fine.

quyxkh
Filter Inserter
Filter Inserter
Posts: 596
Joined: Sun May 08, 2016 9:01 am

Re: [Linux] Comply with the XDG directory standard

Post by quyxkh » Wed Feb 28, 2018 2:52 pm

It's easy enough to get close in an el-cheap-o frontend, I've got a ~/bin/Factorio that does various convenience things but I've never bothered breaking the engine's runtime directory's innards down that far. Factorio's runtime aka write-data directory isn't a good match for any of the XDG standards, it combines runtime, cache, config and data. For so long as its usage doesn't match any of the XDG standards, I think it shouldn't be moved to any of the XDG standard directories. I think splitting cache and runtime can't be done properly with the way they've got it organized now, config can be split with a symlink, and most of data with symlinks for saves, scenario and script-output, but achievements and blueprints are mixed in with the scratch and cache. So it seems to me any overworked sysadmin who's after a nice clean layout set up to ease his workload managing automated backup and garbage collection for dozens-and-up sites is going to be disappointed, this looks like a game built for single-user private home directories.

Why would any administration tool that sees a home-directory dot dir that isn't covered by XDG rules be assigning semantics to its contents anyway? Seems to me that's a tool problem.

Static_Rocket
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Sep 16, 2018 5:35 pm

Re: [Linux] Comply with the XDG directory standard

Post by Static_Rocket » Sun Sep 16, 2018 5:56 pm

I would love to see this game conform to XDG Base Directory specification, but, just to put the specifications perceived importance into perspective, KDE had their name attached to it when it was released in 2003 but five years later, when KDE4 was released, didn't conform itself. (Of course now it follows the spec, but it also keeps the old violating folders active for "compatibility reasons.") It is absolutely frustrating to have the user directory cluttered by endless .directories, but unfortunately I don't think it will get any better.

Post Reply

Return to “Ideas and Suggestions”