2
0
mirror of https://github.com/qarmin/czkawka synced 2024-11-16 06:12:48 +00:00
This commit is contained in:
Rafał Mikrut 2024-01-15 19:47:07 +01:00
parent 97cbbce483
commit e628fcb395
6 changed files with 13 additions and 16 deletions

View File

@ -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)]

View File

@ -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<ProgressData>) {

View File

@ -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<usize> = 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,

View File

@ -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");

View File

@ -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
}

View File

@ -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<MainListModel>, 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::<Vec<_>>();