-
Notifications
You must be signed in to change notification settings - Fork 1.7k
reopen Run Test and Debug execute the code in different working directories #13208
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
Comments
Also related: #6661 |
I have struggled with the same issue, I wanted to use a relative path for a source file for my tests and have it work using run/debug in VS Code and also using
{
"rust-analyzer.runnableEnv": {
"ENV_ROOT_DIR": "${workspaceFolder}"
}
}
pub fn test_data_path() -> String {
static FILE_PATH : &str = "./tests/my-file-name.csv";
match std::env::var("ENV_ROOT_DIR") {
Ok(path) => {
Path::new(&path).join(FILE_PATH).display().to_string()
},
Err(_) => {
Path::new(&std::env::current_dir().unwrap()).join("../").join(FILE_PATH).display().to_string()
}
}
}
|
Also seeing this issue, |
The work-around @d00z3l mentioned works, for the time being until the issue is really fixed. |
If test cases are run from same workspace as they are compiled, then for a workaround perhaps using |
There is already an issue for this but it was closed by mistake and I am unable to reopen it. Several people have replied that the issue was not fixed and yet it remains closed.
#4705
The text was updated successfully, but these errors were encountered: