diff --git a/build.rs b/build.rs index 79b379ef1..931cd11ce 100644 --- a/build.rs +++ b/build.rs @@ -25,14 +25,8 @@ fn main() { .unwrap_or(canonicalize(MANIFEST_DIR).join("target")); // FISH_BUILD_DIR is set by CMake, if we are using it. - // OUT_DIR is set by Cargo when the build script is running (not compiling) - let default_build_dir = env::var("OUT_DIR").unwrap(); - let build_dir = option_env!("FISH_BUILD_DIR").unwrap_or(&default_build_dir); - let build_dir = canonicalize_str(build_dir); - rsconf::set_env_value("FISH_BUILD_DIR", &build_dir); - rsconf::set_env_value( - "FISH_BUILD_OUTPUT_DIR", + "FISH_BUILD_DIR", option_env!("FISH_BUILD_DIR").unwrap_or(cargo_target_dir.to_str().unwrap()), ); diff --git a/src/env/config_paths.rs b/src/env/config_paths.rs index 2c4490887..ad88fa7f2 100644 --- a/src/env/config_paths.rs +++ b/src/env/config_paths.rs @@ -32,7 +32,7 @@ // TODO: we should determine program_name from argv0 somewhere in this file // Detect if we're running right out of the CMAKE build directory - if exec_path.starts_with(env!("FISH_BUILD_OUTPUT_DIR")) { + if exec_path.starts_with(env!("FISH_BUILD_DIR")) { let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); FLOG!( config, diff --git a/src/path.rs b/src/path.rs index 210c7ffe5..add2b01a9 100644 --- a/src/path.rs +++ b/src/path.rs @@ -600,7 +600,7 @@ fn make_base_directory(xdg_var: &wstr, non_xdg_homepath: &wstr) -> BaseDirectory use std::path::PathBuf; let mut build_dir = PathBuf::from(env!("FISH_BUILD_DIR")); - build_dir.push("fish_root"); + build_dir.push("fish-test-home"); let err = match std::fs::create_dir_all(&build_dir) { Ok(_) => 0, diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 48250d77f..b750bebe8 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -42,6 +42,7 @@ pub mod prelude { use std::cell::RefCell; use std::env::set_current_dir; use std::ffi::CString; + use std::path::PathBuf; /// A wrapper around a Parser with some test helpers. pub struct TestParser { @@ -89,8 +90,10 @@ pub fn test_init() -> impl ScopeGuarding { DONE.get_or_init(|| { // If we are building with `cargo build` and have build w/ `cmake`, FISH_BUILD_DIR might // not yet exist. - std::fs::create_dir_all(env!("FISH_BUILD_DIR")).unwrap(); - set_current_dir(env!("FISH_BUILD_DIR")).unwrap(); + let mut test_dir = PathBuf::from(env!("FISH_BUILD_DIR")); + test_dir.push("fish-test"); + std::fs::create_dir_all(&test_dir).unwrap(); + set_current_dir(&test_dir).unwrap(); { let s = CString::new("").unwrap(); unsafe {