Closed
Description
Doing something like
mod script_module {
include!("./script-module.rs");
}
does not work.
I came up with the following solution:
mod script_module {
include!(concat!(env!("PWD"), "/script-module.rs"));
}
But it is not completely cross platform, as PWD
is not defined on Windows (I think unless you're in PowerShell or Git BASH).
All of the CARGO_*
environment variables point inside the ./.rust-script
folder, so there's no way to compose a path that points to the current directory.
I wonder if it's possible to override CARGO_MANIFEST_DIR
to point to the directory in which the script is located, or make env!("RUST_SCRIPT_BASE_PATH")
work (currently RUST_SCRIPT_BASE_PATH
is only defined for the runtime of the script and not during rustc compilation).
Metadata
Metadata
Assignees
Labels
No labels