Skip to content

Commit b33d463

Browse files
committed
Use CARGO_MANIFEST_DIR
1 parent 1fed013 commit b33d463

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/runtest.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,9 +2616,10 @@ actual:\n\
26162616
let parent_dir = self.testpaths.file.parent().unwrap();
26172617
normalize_path(parent_dir, "$DIR");
26182618

2619-
let src_dir_str = std::env::current_dir().unwrap();
2620-
let src_dir = Path::new(&src_dir_str);
2621-
normalize_path(src_dir, "$SRC_DIR");
2619+
if let Ok(src_dir_str) = std::env::var("CARGO_MANIFEST_DIR") {
2620+
let src_dir = Path::new(&src_dir_str);
2621+
normalize_path(src_dir, "$SRC_DIR");
2622+
}
26222623

26232624
// Paths into the build directory
26242625
let test_build_dir = &self.config.build_base;

0 commit comments

Comments
 (0)