(cross-post from SU, was told it would be a better fit here)
I have a repo/application/ecosystem (I am developing or helping develop), let's call it
qux. When qux starts, it needs to
source qux-master/configure_qux.sh or maybe hit some scripts in the repo. However, I can't guarantee where
qux-master is located. Maybe it's at
~/foo/qux-master. Maybe it's under
/opt. Maybe it's in a container and right at the root,
/qux-master. Basically, I want reliable, agnostic, programmatic access to file paths under
Should I be using a package manager? It seems I want to "install" the application in some way. The situation is typically linux, and quite often Ubuntu, though I'd love a more cross-POSIX-ish solution.
One thing I've tried is leveraging AppDirs/XDG Base Dir Spec (e.g. I'll put a link at
$XDG_CONFIG_HOME/qux/configure_qux.sh back to
qux-master/configure_qux.sh) which is okay, but it feels like there ought to be better ways.
What are my options? If this question is "too broad", are there any keywords I can search for this problem to better define what I am looking for?