Closed cdoucet closed 5 years ago
Yes,
Le 30 juil. 2018 à 13:40, cdoucet notifications@github.com a écrit :
In Freefem's DSL, include directive does not look for files in the directory of the file calling this directive. For example, if include "bar.edp" is found in a file $FF_ROOT/foo.edp which is run from $SOMEWHERE, then bar.edp will be search in $SOMEWHERE instead of FF_ROOT.
I would like to modify this behavior (which is implemented in fflib/lex.cpp). The purpose of this modification is to be able to run edp files from anywhere without having to set FF_INCLUDEPATH for that. Note that $FF_ROOT is known because *(pilesource[level].filename) contains it.
Do you agree with this modification?
I prefer to ask before making a pull request.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/FreeFem/FreeFem-sources/issues/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AFb2jBvzWBuCRcdNlAQ8i7E3W_OXQKXrks5uLvCugaJpZM4VmQYk.
I think there is a bug in mylex::xxxx::open
in src/fflib/lex.cpp.
If FF_INCLUDEPATH is empty (i.e. lex->includedir), then the code tries to open ff (i.e. filename). It is ok.
However, if FF_INCLUDEPATH is not empty, then it tries to prepend ff with each path in FF_INCLUDEPATH without trying to open ff alone. But the error message in case of failure says that opening ff failed while it is actually false (even though it is actually the expected behavior). So, I think I will need to modify the original algorithm.
Furthermore, as I would like to modify the behavior of include
directive, I need to know in which order files should be searched for. For example, let say that $FF_ROOT/foo.edp includes bar.edp and that it is run from $SOMEWHERE. What is the order of trials?
Something else?
After checking, there is no bug in the code. I make a PR with the following behavior:
Therefore, only step 2 is new.
In Freefem's DSL, include directive does not look for files in the directory of the file calling this directive. For example, if
include "bar.edp"
is found in a file$FF_ROOT/foo.edp
which is run from$SOMEWHERE
, thenbar.edp
will be search in$SOMEWHERE
instead ofFF_ROOT
.I would like to modify this behavior (which is implemented in fflib/lex.cpp). The purpose of this modification is to be able to run edp files from anywhere without having to set
FF_INCLUDEPATH
for that. Note that$FF_ROOT
is known because*(pilesource[level].filename)
contains it.Do you agree with this modification?
I prefer to ask before making a pull request.