Currently trying to figure out how to provide a sensible default configuration when there's no embedding.
My first idea was that I'll look at argv[0], and look for the assets in the parent directory's share - which kind of works when iocaine is installed, as I can control the layout. It doesn't work when ran with cargo run, because then the parent dir would be target.
So I'm thinking... what if I had search paths? As in, if no config file is specified, iocaine would search for it in:
./iocaine.kdl./etc/iocaine.kdl{dirname(argv[0]))}/../share/etc/iocaine.kdl/run/iocaine/iocaine.kdl/etc/iocaine/iocaine.kdl
And any node in the configuration that accepts a path= property, would accept multiple, and iocaine would find the first one that exists, and would load that.
An alternative option would be to have a
--search-pathoption, and any relative paths would be searched there. That would mean that the configuration itself does not need to be aware of search paths at all.So... if the default search path is:
././share./share/etc{dirname(argv[0])}/../share{dirname(argv[0])}/../share/etc/run/iocaine/etc/iocaineThat should cover both the configuration file (defaulting to
iocaine.kdl), and the default script & module paths (nam-shub-of-enki/pkg.rotoandnam-shub-of-enki/module, respectively).In the repo, I'd have a
sharedirectory that containsetc/iocaine.kdl, andnam-shub-of-enki, so the third path would find the config file, the second would find NSoE, when run withcargo run.On distributions that follow FHS, one of 4-7 would likely land at the right place.
When using a relocatable tarball, 2 & 3 would find the right files too.