From e628fcb395538c2f9dce93969ddb9a8e3b3fef31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 15 Jan 2024 19:47:07 +0100 Subject: [PATCH] Hen --- czkawka_cli/src/commands.rs | 4 ++-- czkawka_cli/src/main.rs | 2 +- czkawka_core/src/common.rs | 11 ++++------- czkawka_core/src/lib.rs | 2 +- czkawka_gui/src/help_functions.rs | 5 ++--- krokiet/src/connect_delete.rs | 5 +++-- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/czkawka_cli/src/commands.rs b/czkawka_cli/src/commands.rs index 346a9f2..a4936da 100644 --- a/czkawka_cli/src/commands.rs +++ b/czkawka_cli/src/commands.rs @@ -7,13 +7,13 @@ use czkawka_core::common_tool::DeleteMethod; use czkawka_core::duplicate::HashType; use czkawka_core::same_music::MusicSimilarity; use czkawka_core::similar_images::SimilarityPreset; -use czkawka_core::CZKAWKA_VERSION; +use czkawka_core::MAIN_SEPARATOR; #[derive(clap::Parser)] #[clap( name = "czkawka", help_template = HELP_TEMPLATE, - version = CZKAWKA_VERSION + version = MAIN_SEPARATOR )] pub struct Args { #[command(subcommand)] diff --git a/czkawka_cli/src/main.rs b/czkawka_cli/src/main.rs index e2baddc..86715e0 100644 --- a/czkawka_cli/src/main.rs +++ b/czkawka_cli/src/main.rs @@ -70,7 +70,7 @@ fn main() { connect_progress(&progress_receiver); - calculate_thread.join().unwrap(); + calculate_thread.unwrap().join().unwrap(); } fn duplicates(duplicates: DuplicatesArgs, stop_receiver: &Receiver<()>, progress_sender: &Sender) { diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 7d225f8..466b167 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -18,11 +18,13 @@ use directories_next::ProjectDirs; use fun_time::fun_time; use handsome_logger::{ColorChoice, ConfigBuilder, TerminalMode}; use image::{DynamicImage, ImageBuffer}; +use imagepipe::{ImageSource, Pipeline}; #[cfg(feature = "heif")] use libheif_rs::{ColorSpace, HeifContext, RgbChroma}; #[cfg(feature = "libraw")] use libraw::Processor; use log::{debug, error, info, warn, LevelFilter, Record}; +use rawloader::RawLoader; use symphonia::core::conv::IntoSample; // #[cfg(feature = "heif")] @@ -34,17 +36,12 @@ use crate::common_messages::Messages; use crate::common_tool::DeleteMethod; use crate::common_traits::ResultEntry; use crate::duplicate::make_hard_link; -use crate::CZKAWKA_VERSION; +use crate::MAIN_SEPARATOR; static NUMBER_OF_THREADS: state::InitCell = state::InitCell::new(); pub const DEFAULT_THREAD_SIZE: usize = 8 * 1024 * 1024; // 8 MB pub const DEFAULT_WORKER_THREAD_SIZE: usize = 4 * 1024 * 1024; // 4 MB -#[cfg(not(target_family = "windows"))] -pub const CHARACTER: char = '/'; -#[cfg(target_family = "windows")] -pub const CHARACTER: char = '\\'; - pub fn get_number_of_threads() -> usize { let data = NUMBER_OF_THREADS.get(); if *data >= 1 { @@ -81,7 +78,7 @@ pub fn print_version_mode() { let info = os_info::get(); info!( - "App version: {CZKAWKA_VERSION}, {debug_release} mode, rust {rust_version}, os {} {} [{} {}], {processors} cpu/threads", + "App version: {MAIN_SEPARATOR}, {debug_release} mode, rust {rust_version}, os {} {} [{} {}], {processors} cpu/threads", info.os_type(), info.version(), std::env::consts::ARCH, diff --git a/czkawka_core/src/lib.rs b/czkawka_core/src/lib.rs index 947b785..c4e36dd 100644 --- a/czkawka_core/src/lib.rs +++ b/czkawka_core/src/lib.rs @@ -29,4 +29,4 @@ pub mod common_tool; pub mod common_traits; pub mod localizer_core; -pub const CZKAWKA_VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const MAIN_SEPARATOR: &str = env!("CARGO_PKG_VERSION"); diff --git a/czkawka_gui/src/help_functions.rs b/czkawka_gui/src/help_functions.rs index 649b6f7..0c778be 100644 --- a/czkawka_gui/src/help_functions.rs +++ b/czkawka_gui/src/help_functions.rs @@ -1,7 +1,7 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::io::BufReader; -use std::path::PathBuf; +use std::path::{PathBuf, MAIN_SEPARATOR}; use gdk4::gdk_pixbuf::{InterpType, Pixbuf}; use glib::Error; @@ -14,7 +14,6 @@ use once_cell::sync::OnceCell; use czkawka_core::bad_extensions::BadExtensions; use czkawka_core::big_file::BigFile; use czkawka_core::broken_files::BrokenFiles; -use czkawka_core::common::CHARACTER; use czkawka_core::common_dir_traversal; use czkawka_core::common_messages::Messages; use czkawka_core::duplicate::DuplicateFinder; @@ -414,7 +413,7 @@ pub fn get_notebook_object_from_tree_view(tree_view: &TreeView) -> &NotebookObje pub fn get_full_name_from_path_name(path: &str, name: &str) -> String { let mut string = String::with_capacity(path.len() + name.len() + 1); string.push_str(path); - string.push(CHARACTER); + string.push(MAIN_SEPARATOR); string.push_str(name); string } diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 282b884..7b30922 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -1,7 +1,8 @@ use rayon::prelude::*; use slint::{ComponentHandle, Model, ModelRc, VecModel}; +use std::path::MAIN_SEPARATOR; -use czkawka_core::common::{remove_folder_if_contains_only_empty_folders, CHARACTER}; +use czkawka_core::common::remove_folder_if_contains_only_empty_folders; use crate::common::{get_is_header_mode, get_name_idx, get_path_idx}; use crate::{Callabler, CurrentTab, GuiState, MainListModel, MainWindow}; @@ -60,7 +61,7 @@ fn remove_selected_items(items: Vec, active_tab: CurrentTab) { .map(|item| { let path = item.val.iter().nth(path_idx).unwrap(); let name = item.val.iter().nth(name_idx).unwrap(); - format!("{}{}{}", path, CHARACTER, name) + format!("{}{}{}", path, MAIN_SEPARATOR, name) }) .collect::>();