This is okay if Script C happens to be in <xyscripts> but not if it and Script B are deeper.
For example, using the attached archive with a fresh v16.20.0300...
If you extract the files to <xyscripts> directly then running either <xyscripts>\Caller.xys or <xyscripts>\Test.xys works correctly and you see a greeting echoed in celebration.
If however you extract them to LibTest under <xyscripts> then:
Running <xyscripts>\LibTest\Caller.xys fails with an 'Include file not found' error.
Running <xyscripts>\LibTest\Test.xys works correctly - showing that include does check the script's directory.
Now according to the documentation the fact that caller fails is not an error, as it never claims to check the working directory - but if you take this stand then Test.xys should also fail then.
However, according to history and my original wish include should follow the same rules as load and this demonstrates that it does not under certain conditions.
Source of archived files:
Caller.xys
Code: Select all
Load 'Test';Code: Select all
function greeting() { echo 'hello world'; }Code: Select all
include_once 'Test.xyi';
greeting();
XYplorer Beta Club