Cool VL Viewer forum

EDITED: Allow sub-directories in #include file names
Page 1 of 1

Author:  TizzyCalliope [ 2022-08-21 04:56:57 ]
Post subject:  EDITED: Allow sub-directories in #include file names

In LSL, #include doesn't seem to allow paths in subdirectories in Windows 11. Given the following files:

~/Documents/LSL Includes/Test/Hello.lsl:
        llOwnerSay("Hello, world!");

~/Documents/LSL Includes/World.lsl:

#define HELLO_WORLD "Hello, world!"

And a script in my inventory:
#pragma include-from: ~/Documents/LSL Includes/
#include "Test/Hello.lsl"

... gets me the error message "Failure to include: Test/Hello.lsl".

This happens both in objects and in my inventory, with "./Test/Hello.lsl", <Test/Hello.lsl> and variants, with and without the trailing slash in the include-from, and so on. It does find the file when the include-from is "~/Documents/LSL Includes/Test" and the #include is for "Hello.lsl", which is therefore an obvious workaround, but not when the #include is "./Hello.lsl".

Author:  Henri Beauchamp [ 2022-08-21 12:30:57 ]
Post subject:  Re: EDITED: Allow sub-directories in #include file names

This is the expected bevhaviour, i.e. #include only currently accepts file names without any sub-directory path. It also applies to Lua #includes.

This is because file names are sanitized to forbid any attempt to "climb-up" the directory tree and load forbidden files (such as system files).

However, I do acknowledge the usefulness of sub-directories for large projects, so this feature (sub-directories support in #included file names) will be part of next release.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group