mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Use CARGO_MANIFEST_DIR to see if we're running from build dir
This allows running a fish built from `cargo build` *and* built via cmake. In future, we should make this an optional thing that's removed from installed builds.
This commit is contained in:
parent
3ecd835f58
commit
89282fd9bc
1 changed files with 2 additions and 4 deletions
|
@ -77,8 +77,6 @@ const DATA_DIR: &str = env!("DATADIR");
|
||||||
const SYSCONF_DIR: &str = env!("SYSCONFDIR");
|
const SYSCONF_DIR: &str = env!("SYSCONFDIR");
|
||||||
const BIN_DIR: &str = env!("BINDIR");
|
const BIN_DIR: &str = env!("BINDIR");
|
||||||
|
|
||||||
const OUT_DIR: &str = env!("FISH_BUILD_DIR");
|
|
||||||
|
|
||||||
/// container to hold the options specified within the command line
|
/// container to hold the options specified within the command line
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
struct FishCmdOpts {
|
struct FishCmdOpts {
|
||||||
|
@ -160,7 +158,7 @@ fn determine_config_directory_paths(argv0: impl AsRef<Path>) -> ConfigPaths {
|
||||||
// TODO: we should determine program_name from argv0 somewhere in this file
|
// TODO: we should determine program_name from argv0 somewhere in this file
|
||||||
|
|
||||||
// Detect if we're running right out of the CMAKE build directory
|
// Detect if we're running right out of the CMAKE build directory
|
||||||
if exec_path.starts_with(OUT_DIR) {
|
if exec_path.starts_with(env!("CARGO_MANIFEST_DIR")) {
|
||||||
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
FLOG!(
|
FLOG!(
|
||||||
config,
|
config,
|
||||||
|
@ -172,7 +170,7 @@ fn determine_config_directory_paths(argv0: impl AsRef<Path>) -> ConfigPaths {
|
||||||
data: manifest_dir.join("share"),
|
data: manifest_dir.join("share"),
|
||||||
sysconf: manifest_dir.join("etc"),
|
sysconf: manifest_dir.join("etc"),
|
||||||
doc: manifest_dir.join("user_doc/html"),
|
doc: manifest_dir.join("user_doc/html"),
|
||||||
bin: OUT_DIR.into(),
|
bin: exec_path.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue