git.lucas.co / cce-graph
node-based graph editor
git clone https://git.lucas.co/cce-graph.git

commit7e9a8f5d796eb37b80abaf882b3bb221186f1f53
parent3c259acebe
authorLucas Galante <[email protected]>
date2026-07-07 12:17
refactor: use cce_ui::config::cce_config_dir for default project path

Replace the inlined XDG_CONFIG_HOME/$HOME branch with the shared helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

 src/main.rs | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index e6befd8..1527121 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -82,18 +82,7 @@ struct GraphApp {
 }
 
 fn get_default_project_path() -> std::path::PathBuf {
-    let dir = if let Ok(xdg_config) = std::env::var("XDG_CONFIG_HOME") {
-        if !xdg_config.is_empty() {
-            std::path::PathBuf::from(xdg_config)
-        } else {
-            let home = std::env::var("HOME").unwrap_or_default();
-            std::path::PathBuf::from(home).join(".config")
-        }
-    } else {
-        let home = std::env::var("HOME").unwrap_or_default();
-        std::path::PathBuf::from(home).join(".config")
-    };
-    dir.join("cce").join("cce-graph").join("default.kdl")
+    cce_ui::config::cce_config_dir().join("cce-graph").join("default.kdl")
 }
 
 fn ensure_default_project_file(path: &std::path::Path) -> Result<(), Box<dyn std::error::Error>> {