FS#6603 - Insert XDG_DATA_DIRS into data loading path

Attached to Project: OpenTTD
Opened by chrysn (chrysn) - Saturday, 12 August 2017, 14:43 GMT
Type Feature Request
Category Core
Status New
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


For openttd to be usable in a relocatable way (in the sense of that the same build can be installed in arbitrary locations), it would be nice if the path described in XDG_DATA_DIRS (as described on [1]).

My use case is user installable debian packages, but the mechanism is used by snappy packages just as well, and can benefit flatpak as same build that is used for regular installations can then also be used in flatpak.

I'd provide a patch for that, but the current mechanism with the `enum Searchpath` can not easily be extended to components that are paths by themselves: There can be one SP_SHARED_DIR, but XDG_DATA_DIRS could contain `/home/user/my-packages/share:/usr/share`.

Would it be OK to replace some of the Searchpath mechanism with something that can get multi-path components from the environment? Should I try to make it work with the enum style paths, possibly making NUM_SEARCHPATHS a static int rather than a constant? Do you have better suggestions on how I could approach such a change?

This task depends upon