This commit is contained in:
Charles Cunningham
2026-01-29 10:42:17 -08:00
parent 23855a07f3
commit 8d542f890f

View File

@@ -1,3 +1,4 @@
use path_absolutize::Absolutize;
use std::env;
use std::ffi;
use std::ffi::OsString;
@@ -123,6 +124,12 @@ fn cargo_target_dir() -> Result<PathBuf, CargoBinError> {
Ok(path)
}
fn absolutize_from_buck_or_cwd(path: PathBuf) -> Result<PathBuf, CargoBinError> {
path.absolutize()
.map(|abs| abs.into_owned())
.map_err(|source| CargoBinError::CurrentDir { source })
}
/// Macro that derives the path to a test resource at runtime, the value of
/// which depends on whether Cargo or Bazel is being used to build and run a
/// test. Note the return value may be a relative or absolute path.