Interpret imports relative to the location of the file containing them rather than the current working directory #915
Labels
G-Scenarios
An issue having to do with scenario design, the way scenarios are described and loaded, etc.
S-Critical
This is an issue that seriously affects playability or user experience.
Z-Developer Experience
This issue seeks to make life easier for developers writing Scenarios or other Swarm code.
Z-Feature
A new feature to be added to the game.
Z-Temporary workaround
Short-term solution intended to be deprecated
I'd like to distribute a self-contained demo "Gosling simulator" as a GitHub gist (practically speaking, a
.zip
file). This demo includes both a scenario (.yaml
) file and multiple swarm-lang (.sw
) files.However, there's not a clear way in the scenario file to specify a path to scripts that is "relative" to the scenario file, such that the scenario can be run outside of the
swarm/
directory. Paths in therun
command seem to be relative to the current working directory.Describe the solution you'd like
For a file hierarchy like this:
and when
swarm
is invoked like this:Support a notation like this in the REPL/swarm-lang code:
The
@
sign indicates thatmyscript.sw
exists in the same directory as the scenario currently being played (in this case, themyscenario.yaml
file).For a hierarchy like this:
The command would be:
The text was updated successfully, but these errors were encountered: