diff options
Diffstat (limited to 'utils/src/env.rs')
| -rw-r--r-- | utils/src/env.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/src/env.rs b/utils/src/env.rs index 81dfbd7..1834cd3 100644 --- a/utils/src/env.rs +++ b/utils/src/env.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + /// Returns the current locale string based on environment variables. /// /// The function checks for locale settings in the following order: @@ -92,3 +94,14 @@ pub async fn get_default_editor() -> String { "jvii".to_string() } + +/// Get temporary file path +pub fn current_tempfile_path(name: &str) -> Option<PathBuf> { + dirs::config_local_dir().map(|path| { + if cfg!(target_os = "linux") { + path.join("jvcs").join(".temp").join(name) + } else { + path.join("JustEnoughVCS").join(".temp").join(name) + } + }) +} |
