[FIXED] Scripting: include search path errors.

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

[FIXED] Scripting: include search path errors.

Post by TheQwerty »

Include fails to check the loaded script's directory when there's a bit of redirection. (Script A loads Script B which includes Script C.)

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.
LibTest.zip
Source of archived files:
Caller.xys

Code: Select all

Load 'Test';
Test.xyi

Code: Select all

function greeting() { echo 'hello world'; }
Test.xys

Code: Select all

include_once 'Test.xyi';

greeting();
[/size]
To see the attached files, you need to log into the forum.
Last edited by TheQwerty on 22 Feb 2016 15:47, edited 1 time in total.
Reason: Fixed in v16.20.0305 - 2016-02-19 18:11

admin
Site Admin
Posts: 67292
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting: include search path errors.

Post by admin »

Thanks, fix is on the way. :tup:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting: include search path errors.

Post by TheQwerty »

Fix confirmed in v16.20.0307!
:beer:

Post Reply