View Issue Details

IDProjectCategoryView StatusLast Update
0011800Dwarf FortressTechnical -- Generalpublic2021-08-27 04:44
Reporterkritzefitz Assigned To 
PrioritylowSeverityfeatureReproducibilityN/A
Status newResolutionopen 
PlatformLinuxOSDebianOS VersionBookworm
Product Version0.47.05 
Summary0011800: Supporting different installation directories for various kinds of files.
DescriptionCurrently Dwarf Fortress is designed to be downloaded as a tarball, unpacked and the run directly from that unpacked directory. This is of course totally fine for people who download Dwarf Fortress directly from the website. However, it makes the creation of packages for Linux distributions such as Debian kinda tricky.

First some background: For Linux systems there are various standards that mandate where certain files ought to be installed. On one hand there's the Filesystem Hierarchy Standard (https://www.debian.org/doc/packaging-manuals/fhs/fhs-3.0.html) which is mandatory for all Debian packages and there is the XDG Base Directory Specification (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) which isn't strictly mandatory, but would be appropriate for Dwarf Fortress to follow. Most notably this is different from the way Dwarf Fortress currently works (and installations usually work on Windows), because files are sorted into directories depending on what kind of file they are, not what software they belong to. This means that files belonging to the same software still end up in different directories across the system.

For the files of Dwarf Fortress this means that they would have to be installed somewhat like this:


      
  • df -> /usr/games/dwarf-fortess

  •   
  • libs/Dwarf_Fortress -> /usr/libexec/games/dwarf-fortress/Dwarf_Fortress

  •   
  • libs/libgraphics.so -> /usr/lib/games/dwarf-fortress/libgraphics.so

  •   
  • data/ -> /usr/share/games/dwarf-fortress/data/

  •   
  • data/init -> /etc/xdg/dwarf-fortress/

  •   
  • raw/ -> /usr/share/games/dwarf-fortress/raw/



If I simply were to install Dwarf Fortress this way, of course it wouldn't find any of its data files, so that's not an option.

Even if it's not something to be taken care of in the current development state of Dwarf Fortress, I would really like to see this as a feature, even if only in the far future.
Additional InformationFor the Debian package I Currently use a workaround, where I install the files roughly as listed above. But before Dwarf_Fortress is started, a wrapper script is called, that creates a temporary directory and creates symlinks to all the relevant files where they are actually installed.

This has to take care of some problems with file permissions. Namely, the installation directories I listed above aren't writable for regular users who run Dwarf Fortress. Since Dwarf Fortress needs to write some data (such as saves and changed configuration), we need to trick around a bit, so Dwarf Fortress is actually able to change the configuration. To do this, data files aren't only looked up in one directory, but in a list of directories. Changes to those files are always returned in the first directory in the list, which points to a directory inside the user's home directory, where Dwarf Fortess actually has write permissions.

The search paths for the different kinds of files are as follows:


      
  • Data files:
    1. /usr/share/games/dwarf-fortress
    2. /usr/local/shar/dwarf-fortress/*
    3. ~/.local/share/dwarf-fortress/*
    4. modifications to data is retained in ~/.local/share/dwarf-fortress/run/

  •   
  • Configuration:
    1. /etc/xdg/dwarf-fortress
    2. modifications are retained in ~/.local/config/dwarf-fortress



    • This is largely the way the XDG Base Directory Specification lays out for searching for data files and configuration. This even brings in a feature that Dwarf Fortress currently doesn't have on its own. Namely you can install data extensions (such as tilesets or mods) without modifying the original files of Dwarf Fortress, by placing the extension files at the front of the search path. Fro example if you place some extension files on /usr/local/share/dwarf-fortress/my-mod, the files from the mod take precedence over those from vanilla Dwarf Fortress. If you later remove the directory /usr/local/share/dwarf-fortress/my-mod, the mod is cleanly gone and the original files from vanilla take over again.

      If Dwarf Fortress were to implement this feature itself, I think it would do good to also implement this XDG style searching of data files.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Add Note

Note

Issue History

Date Modified Username Field Change
2021-08-27 04:44 kritzefitz New Issue