diff --git a/Cargo.lock b/Cargo.lock index 0faab76..be2507b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -721,7 +721,7 @@ dependencies = [ [[package]] name = "noentropy" -version = "0.1.0" +version = "1.0.3" dependencies = [ "clap", "colored", diff --git a/Cargo.toml b/Cargo.toml index a7e385b..6a19273 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noentropy" -version = "0.1.0" +version = "1.0.3" edition = "2024" [dependencies] diff --git a/src/cli/orchestrator.rs b/src/cli/orchestrator.rs index 42fb748..1a13973 100644 --- a/src/cli/orchestrator.rs +++ b/src/cli/orchestrator.rs @@ -96,11 +96,9 @@ pub async fn handle_organization( ) -> Result<(), Box> { let client: GeminiClient = GeminiClient::new(api_key); - let mut cache_path = std::env::var("HOME") - .map(PathBuf::from) - .expect("No Home found"); - cache_path.push(".config/noentropy/data/.noentropy_cache.json"); - let mut cache = Cache::load_or_create(cache_path.as_path()); + let data_dir = Config::get_data_dir()?; + let cache_path = data_dir.join(".noentropy_cache.json"); + let mut cache = Cache::load_or_create(&cache_path); cache.cleanup_old_entries(7 * 24 * 60 * 60); diff --git a/src/files/mover.rs b/src/files/mover.rs index 627d0dc..9a7f5bf 100644 --- a/src/files/mover.rs +++ b/src/files/mover.rs @@ -2,6 +2,7 @@ use crate::models::OrganizationPlan; use crate::storage::UndoLog; use colored::*; use std::io; +use std::path::MAIN_SEPARATOR; use std::{ffi::OsStr, fs, path::Path}; pub fn execute_move(base_path: &Path, plan: OrganizationPlan, mut undo_log: Option<&mut UndoLog>) { @@ -15,10 +16,18 @@ pub fn execute_move(base_path: &Path, plan: OrganizationPlan, mut undo_log: Opti for item in &plan.files { let mut target_display = format!("{}", item.category.green()); if !item.sub_category.is_empty() { - target_display = format!("{}/{}", target_display, item.sub_category.blue()); + target_display = format!( + "{}{}{}", + target_display, + MAIN_SEPARATOR, + item.sub_category.blue() + ); } - println!("Plan: {} -> {}/", item.filename, target_display); + println!( + "Plan: {} -> {}{}", + item.filename, target_display, MAIN_SEPARATOR + ); } eprint!("\nDo you want to apply these changes? [y/N]: "); @@ -74,12 +83,18 @@ pub fn execute_move(base_path: &Path, plan: OrganizationPlan, mut undo_log: Opti match move_file_cross_platform(&source, &target) { Ok(_) => { if item.sub_category.is_empty() { - println!("Moved: {} -> {}/", item.filename, item.category.green()); - } else { println!( - "Moved: {} -> {}/{}", + "Moved: {} -> {}{}", item.filename, item.category.green(), + MAIN_SEPARATOR + ); + } else { + println!( + "Moved: {} -> {}{}{}", + item.filename, + item.category.green(), + MAIN_SEPARATOR, item.sub_category.blue() ); }