Nothing entered.
Hello. I've been trying to setup Arx Libertatis on Linux as a system install (where users have no write permissions) but have a few problems and believe the following points need considered;
- Try creating user directories regardless of data directory detection.
- Copy cfg.ini file rather than moving.
- Use executable path as possible data directory location.
1) If the USER_DIR_PREFIXES/USER_DIR and CONFIG_DIR_PREFIXES/CONFIG_DIR directories are not manually pre-created then Arx does not create them itself and falls back to current working directory. Reading
http://wiki.arx-libertatis.org/Data_directories I believe this due to the data directory not being found as install locations may, especially with games, not always match XDG specifications. Arx should try creating these user directories if not present regardless of data directory not being found (especially as game still runs when current working directory is that of install). Any missing ini files will be still be copied later.
# ./arx-debug --debug=core
[D] Startup:119 No data directory found.
[D] Startup:170 Using working directory as user directory: "."
[D] Startup:218 Using user directory as config directory: "."
...
[I] Core:4043 Clean shutdown
2) Manually creating the ~/.config/arx allows local configuration settings to be saved. From the cfg.ini warning below I would suggest that this be a file copy rather than a file move to support system installs by changing fs::rename to fs::copy in Application::InitConfig() in src/core/Application.cpp perhaps.
# mkdir ~/.config/arx
# ./arx-debug --debug=core
[D] Startup:119 No data directory found.
[D] Startup:170 Using working directory as user directory: "."
[D] Startup:187 Got config directory from CONFIG_DIR_PREFIXES: "/home/user/.config/arx"
...
[W] Application:219 could not move "cfg.ini" to "/home/user/.config/arx/cfg.ini"
...
[I] Core:4043 Clean shutdown
3) However then creating ~/.local/share/arx causes game to fail to run even though current working directory is still the game directory and was running previously! I would suggest using getExecutablePath() in src/platform/Environment.cpp as possible data directory too rather than requiring --data-dir be passed.
# mkdir ~/.local/share/arx
# ./arx-debug --debug=core
[D] Startup:119 No data directory found.
[D] Startup:142 Got user directory from USER_DIR_PREFIXES: "/home/user/.local/share/arx"
[D] Startup:187 Got config directory from CONFIG_DIR_PREFIXES: "/home/user/.config/arx"
...
[W] Application:219 could not move "cfg.ini" to "/home/user/.config/arx/cfg.ini"
...
[CRITICAL] ArxGame:468 Unable to find data.pak in "/home/user/.local/share/arx"
[CRITICAL] ArxGame:407 Error loading pak files
[CRITICAL] ArxGame:243 Failed to initialize the game data.
[CRITICAL] Core:676 Application failed to initialize properly.
# ./arx-debug --debug=core --data-dir=/srv/games/ArxFatalis
[D] Startup:464 Got data directory from command-line: "/srv/games/ArxFatalis"
[D] Startup:142 Got user directory from USER_DIR_PREFIXES: "/home/user/.local/share/arx"
[D] Startup:187 Got config directory from CONFIG_DIR_PREFIXES: "/home/user/.config/arx"
...
[I] Core:4043 Clean shutdown
APPENDIX) For reference this is the list directories output;
# ./arx-debug --list-dirs
Data directories (data files):
- --data-dir (-d) command-line parameter
- "games/arx" in one of "$XDG_DATA_DIRS"
= "/usr/local/share:/usr/share:/usr/share/gdm":
* "/usr/local/share/games/arx"
* "/usr/share/games/arx"
* "/usr/share/gdm/games/arx"
- "games/arx"
selected: (none)
User directories (save files, data files):
- --user-dir (-u) command-line parameter
- "arx" in one of "$XDG_DATA_HOME"
= "/home/user/.local/share":
* "/home/user/.local/share/arx"
- "arx"
- Current working directory
selected: "."
Config directories:
- --config-dir (-c) command-line parameter
- "arx" in one of "$XDG_CONFIG_HOME"
= "/home/user/.config":
* "/home/user/.config/arx"
- "arx"
- The selected user directory
selected: "."
Other than that, thank you for all your work on this port!
Really delete this comment?
Really delete this comment?
1. System-wide install ⇑ top
In this mode, shared read only data is loaded from /usr/share/games/arx (for data installed by package managers) or /usr/local/share/games/arx (for data installed without a package manager) or from games/arx in any $XDG_DATA_DIRSPer-user files are stored in ~/.local/share/arx ($XDG_DATA_HOME/arx) and config in ~/.config/arx ($XDG_CONFIG_HOME/arx)
Data files are also loaded from ~/.local/share/arx to support per-user mods etc
User and config directories are automatically created if the system-wide data directory is found.
2. Per-user install ⇑ top
For this install mode there is no system-wide data directory. Instead, all data is loaded from the user directory ~/.local/share/arx ($XDG_DATA_HOME/arx).Config is still loaded from ($XDG_CONFIG_HOME/arx)
The config directory is created if the user directory was found.
3. Portable / not installed ⇑ top
This mode is intended to package data and user files in one directory that can be quickly moved between systems. It is also how pre-release Arx Libertatis worked for a long time.Here there is no system-wide data directory and both user and config directories are the current working directory.
In thus mode nothing should ever be created in $HOME as that is outside of the install.
Now to your comments... ⇑ top
Correct. However, if a data directory is found or specified on the command-line, both user and config directories are created automatically.
Well, they should! Also, to be clear, the XDG Base Directory Specification does *not* specify install locations (except defaults). Instead it specifies environment variables that contain install location prefixes (amongst other things). Actual locations are covered by the Filesystem Hierarchy Standard (FHS) standard here does not mean that all distributions follow it completely, which is complete orthogonal standard and doesn't really interest arx that much - it is the responsibility of the distro to specifies the XDG variables if the defaults are not sufficient.
Why? If the data and user directories could not be found, arx will not start due to missing data files - so why spam the user's home directory with files/dirs that won't be used (yet). After all, the user might have wanted to use an install mode that did not include those directories.
If you looked at that code you must have noticed that that move is only executed if no config file exists in the config directory, but one exists in the *user* directory, which is defined to be the user's data and should always be writable to the users. The system-wide data directory is never searched for "cfg.ini". If you want a custom system-wide cfg.ini that is copied on the first start, name it "cfg_default.ini", which is loaded from the user and system-wide data directories (in that order of preference).
The only purpose of the move is to migrate old config files as pre-release AL did not always use ~/.config
Also, that is a warning only and will not break the game - it will simply use the hardcoded default config values and save those (and any changes) to ~/.config/arx/cfg.ini later.
Yes, this is expected. If the user directory was not found arx will fall back to use the current directory and will the load the data from there. Now that a different user directory is found (the one you created) arx has no more business looking in the CWD - consider that the CWD when launching arx from the .desktop shortcut will be '~' for most users or any random location - why should we look for data files there. What you really want is arx to find your system-wide data directory. Note that you can pass relative directories to --data-dir, so --data-dir=. will load the data files from the CWD even if a user directory is found.
The only scenario I can think of (in a FHS world) where the binary directory is also the data directory is the portable install mode and there the binary dir = user dir = config dir (and no system-wide data directory!) so the data will be found through the user directory.
What, why would you store game data in /srv/? Is this actually common in any distro? The FHS says /srv is for "Data for services provided by this system" and "contains site-specific data which is served by this system.". As arx is not a service and the data should not be site-specific, i don't see why this directory would be used.
Now as for possible solutions (assuming you want data to be stored in /srv):
Note: cmake will remember changes to these variables until you remove CMakeCache.txt
Signed in users can edit their descriptions / comments ;-). The next bug tracker version will support OpenID, so that should be even easier.
Really delete this comment?
Really delete this comment?
However, XDG_DATA_DIR specifications are definitely in the minority for commercial and ex-commercial game installs. The vast majority of commercial and ex-commercial games for Linux uses the executables path as the data directory, whether started via a symbolic link in bin path or a desktop entry. Whilst this can be in part related to install methods used, the real reason is often due to the sheer size of commercial games. Users create specific partitions for games that do not lie in the XDG specifications. In my example it was /srv/game but is more usually /usr/local/games. Yes, users could add this to XDG_DATA_DIRS but also consider users defining their own directory names to which games are installed such as /usr/local/games/ArxFatalis.
In a system install asking each user to define data-dir when the game could simply resolve the executable path itself is not friendly.
Perhaps I'm just old school.
Really delete this comment?
And they should (/usr/local/games is part of the default list for XDG_DATA_DIRS). How would you install other open source games with larger data files? Why should the install locations be different just because the game is ex-commercial?
I have no problem with adding additional logic to the data directory detection algorithm to make more users happy, as long as it doesn't break existing install modes. And using the executable dir as the data dir does break at least the portable install, as the game doesn't know if the config/saves should be put in the home dir (your system install) or in the game dir (the portable install). I also realize that the portable install is probably not much more common than a custom install such as yours - maybe even less - but as far as changes go, not breaking things for existing users has priority.
My opinion is that such custom installs that don't fit in with the XDG-basedir/FHS specs is best done with a wrapper script that sets the data dir to the custom location - that is after all not too uncommon in the commercial game install you want to emulate. Something like
That is very much something worth considering. But how should the game detect this without the user having to define something? (they can already achieve this by creating a wrapper script) Looking at the executable path is just not a general solution, especially considering how AL is normally meant to be installed.
One option would be to pre-define a list and then use the first one found (e.g 'arx:ArxLibertatis:ArxFatalis') but there will surely be someone this does not cover.
Again, may be this is better covered with a wrapper script.
Really delete this comment?
Really delete this comment?
Really delete this comment?
Really delete this comment?
Really delete this comment?
Also, more directories are now considered for data dirs: - $XDG_DATA_DIRS/games/arx - $XDG_DATA_DIRS/arx - /opt/games/arx - /opt/arx - executable path
The issue was updated with the following change(s):
Really delete this comment?
Really delete this comment?