Open lowlevl opened 6 years ago
Sorry, I didn't really read the documentation, but relative path to the current file seemed so intuitive that, I'll transform this issue in an improvement request.
Edit: Of course I can help !
It may be tricky to get the location of the file; may require platform-specific code for Unix, Windows, etc.. If you can write a patch to implement this, I'll be happy to look it over.
I don't think that would be too tricky :)
Since the readFile()
function passes a string with the loaded file path, we could just use on insert:
/* Pseudo-Code */
if(directive == "include")
{
doInclude(dirname(filePath) + includePath);
}
Don't you think ? @hyperrealm
So somehow it would do:
/* Pseudo-Code */
doInclude("../project/sysconf/" + "otherconf.cf");
to recreate the @include "../project/sysconf/otherconf.cf"
.
Hi @hyperrealm, I'm using your lib in my project, and I noticed a bug,
@include
isn't relative to the current file, but to the execution directory.Here is my working environnement:
My main.cc is loading the
main.cf
like following because I execute the binary from the build directory:From here there is no bug, now look to my
main.cf
:Which produce:
cannot open include file on line: 1
.But when I use this
main.cf
:It works perfectly well.
Edit: I think I need to set and include directory ? Wouldn't it be better to treat
@include
path as relative ?