summaryrefslogtreecommitdiff
path: root/iced_builder/src/environment.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-01-11 01:50:16 +0100
committerpml68 <contact@pml68.dev>2025-01-11 01:50:16 +0100
commit61926598ce96bee00aafe5340af4a905759b122a (patch)
treeb79e13b3decc778cc7c66af7187c647ae0a21a52 /iced_builder/src/environment.rs
parentrefactor: apply clippy suggestions (diff)
downloadiced-builder-61926598ce96bee00aafe5340af4a905759b122a.tar.gz
refactor: remove iced_drop & workspace
Diffstat (limited to 'iced_builder/src/environment.rs')
-rw-r--r--iced_builder/src/environment.rs43
1 files changed, 0 insertions, 43 deletions
diff --git a/iced_builder/src/environment.rs b/iced_builder/src/environment.rs
deleted file mode 100644
index 3ecb790..0000000
--- a/iced_builder/src/environment.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-use std::env;
-use std::path::PathBuf;
-
-pub const CONFIG_FILE_NAME: &str = "config.toml";
-
-pub fn config_dir() -> PathBuf {
- portable_dir().unwrap_or_else(platform_specific_config_dir)
-}
-
-fn portable_dir() -> Option<PathBuf> {
- let exe = env::current_exe().ok()?;
- let dir = exe.parent()?;
-
- dir.join(CONFIG_FILE_NAME)
- .is_file()
- .then(|| dir.to_path_buf())
-}
-
-fn platform_specific_config_dir() -> PathBuf {
- #[cfg(target_os = "macos")]
- {
- xdg_config_dir().unwrap_or_else(|| {
- dirs_next::config_dir()
- .expect("expected valid config dir")
- .join("iced-builder")
- })
- }
- #[cfg(not(target_os = "macos"))]
- {
- dirs_next::config_dir()
- .expect("expected valid config dir")
- .join("iced-builder")
- }
-}
-
-#[cfg(target_os = "macos")]
-fn xdg_config_dir() -> Option<PathBuf> {
- let config_dir = xdg::BaseDirectories::with_prefix("iced-builder")
- .ok()
- .and_then(|xdg| xdg.find_config_file(CONFIG_FILE_NAME))?;
-
- config_dir.parent().map(|p| p.to_path_buf())
-}