Skip to content
Discussion options

You must be logged in to vote

I reckon that error comes from validate_path in RustScriptLanguage, which rejects any script whose path does not start with the directory the library registered as its script root. The registered root is not the whole crate, it is computed by the define_script_root! macro as CARGO_MANIFEST_DIR, then "/src", then the crate's module path with "::" turned into "/" and the crate name's dashes turned into underscores.
So if your crate is named my-game and your init! macro is invoked from the module my_game::scripts, the accepted root is /src/scripts, and a .rs file anywhere else in the crate fails that starts_with check and produces exactly this message. Two conditions therefore have to hold.

  1. R…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@atollk
Comment options

Answer selected by atollk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants