diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-05-12 20:11:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-12 20:11:06 +0200 |
| commit | a24c7f79f1ac40f1e8554aa1615b0a7e020c7ca5 (patch) | |
| tree | cf809552c3f676c5dee56873052a5a584e377623 /src/common/utils | |
| parent | Merge pull request #497 from a-kenji/fix-default-keybind (diff) | |
| parent | Merge branch 'main' of https://github.com/zellij-org/zellij into set-data-dir (diff) | |
| download | sl0ppij-a24c7f79f1ac40f1e8554aa1615b0a7e020c7ca5.tar.gz sl0ppij-a24c7f79f1ac40f1e8554aa1615b0a7e020c7ca5.tar.xz sl0ppij-a24c7f79f1ac40f1e8554aa1615b0a7e020c7ca5.zip | |
Merge pull request #465 from a-kenji/set-data-dir
Add Complile Time System Directories
Diffstat (limited to 'src/common/utils')
| -rw-r--r-- | src/common/utils/consts.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/common/utils/consts.rs b/src/common/utils/consts.rs index bc8768ce..c77f1c9e 100644 --- a/src/common/utils/consts.rs +++ b/src/common/utils/consts.rs @@ -11,8 +11,16 @@ pub const ZELLIJ_CONFIG_FILE_ENV: &str = "ZELLIJ_CONFIG_FILE"; pub const ZELLIJ_CONFIG_DIR_ENV: &str = "ZELLIJ_CONFIG_DIR"; pub const VERSION: &str = env!("CARGO_PKG_VERSION"); -// TODO: ${PREFIX} argument in makefile pub const SYSTEM_DEFAULT_CONFIG_DIR: &str = "/etc/zellij"; +pub const SYSTEM_DEFAULT_DATA_DIR_PREFIX: &str = system_default_data_dir(); + +const fn system_default_data_dir() -> &'static str { + if let Some(data_dir) = std::option_env!("PREFIX") { + data_dir + } else { + &"/usr" + } +} lazy_static! { static ref UID: Uid = Uid::current(); |
