Skip to content

SAW ignores SAW_IMPORT_PATH/--import-path #2756

@RyanGlScott

Description

@RyanGlScott

Support I have a project structure that looks like this:

.
├── a.saw
└── b_dir
    └── b.saw

2 directories, 2 files

Where a.saw and b.saw are defined like so:

// a.saw
include "b.saw";

print x;
// b.saw
let x = 42;

Although b.saw is not defined in the same directory as a.saw, my understanding is that SAW should be able to resolve the include "b.saw"; statement in a.saw if I set one of SAW_IMPORT_PATH=... or --import-path=... to point to b_dir. In practice, however, neither appears to work:

$ SAW_IMPORT_PATH=b_dir saw a.saw
[20:23:10.393] Loading file "a.saw"
[20:23:10.395] Loading file "b.saw"
[20:23:10.395] Stack trace:
   (builtin) in include
   a.saw:2:1-2:16 (at top level)
b.saw: openFile: does not exist (No such file or directory)

$ saw --import-path=b_dir a.saw
[20:23:39.722] Loading file "a.saw"
[20:23:39.723] Loading file "b.saw"
[20:23:39.723] Stack trace:
   (builtin) in include
   a.saw:2:1-2:16 (at top level)
b.saw: openFile: does not exist (No such file or directory)

These options are only used from within the findAndLoadFile function, but this is dead code, as it isn't called anywhere. Note that SAW itself loads files through a different mechanism (loadFile).

Metadata

Metadata

Assignees

Labels

subsystem: saw-scriptIssues related to the SAWScript language and/or its interpretation and executiontype: bugIssues reporting bugs or unexpected/unwanted behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions