Hello everyone,
I wanted to ask this here to make good use of people’s prod experience, as most of my projects are hobby programs. I have a program that loads data from a path. And I would like for that program to support different install hierarchies e.g. “portable” with everything under one dir, or part of a system, where the packager decides where everything should be.
How do you usually approach resource resolution?
I can think of a couple approaches:
- store permutations of where the file could be;
/share/...
,/usr/share/...
,~/.local/share/...
which seems like the worst idea in general - make paths build-time params; interface with dune somehow to have it fill templates in your code upon
dune install
is one way of doing this. - make paths runtime params provided in environment and via flags
- some mix of the above
Then there’s also the consideration for how to express those paths across windows/unix-likes with their different filesystem quirks
package maintainer insight is especially appreciated!