diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-05-06 21:38:10 +0200 |
|---|---|---|
| committer | a-kenji <aks.kenji@protonmail.com> | 2021-05-12 19:51:29 +0200 |
| commit | ffd8f17a94e60dc7fffea0a1ef5efccc693c5cd9 (patch) | |
| tree | 62da299a597d95b7ba12272c3df4bc3ec7fc7ecd /src/common/utils | |
| parent | Merge pull request #223 from zellij-org/isolate-pty (diff) | |
| download | sl0ppij-ffd8f17a94e60dc7fffea0a1ef5efccc693c5cd9.tar.gz sl0ppij-ffd8f17a94e60dc7fffea0a1ef5efccc693c5cd9.tar.xz sl0ppij-ffd8f17a94e60dc7fffea0a1ef5efccc693c5cd9.zip | |
Add Complile Time System Directories
closes #380
* --features disable_automatic_asset_installation
disables automatic installation of the `data_dir`
* a set PREFIX env will use `$PREFIX/zellij` as its `data_dir`
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 a46f8243..29870d97 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(); |
