Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access resources outside of the target folder #296

Open
patmuk opened this issue Nov 25, 2024 · 1 comment
Open

Can't access resources outside of the target folder #296

patmuk opened this issue Nov 25, 2024 · 1 comment

Comments

@patmuk
Copy link

patmuk commented Nov 25, 2024

I have a proc-macro, which loads a file from a given location to generate code.
I call it this way:

#[generate_api("tests/good_source_file/mod.rs")]
impl Lifecycle for LifecycleImpl {

Using try build the given file can't be found, because "cwd" and "CARGO_TARGET_DIR" are redirected to $DIR/target/tests/trybuild.

Is there anyway I can change that?
I don't want to hardcode a full path - the macro assumes the file's location is relative to the project's root directory.

Needless to say, outside of trybuild::TestCases::new().pass("tests/ui_tests.rs"); the file loading works.

@addisoncrump
Copy link

Seconding this, I need a resource adjacent to my test. I ended up using ../../../../<path/from/workspace> to access this, but this is probably not stable and is a bit gross.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants