1
0
Fork 0
mirror of synced 2024-04-27 17:22:13 +12:00

Better explanation, starting working with GUI

This commit is contained in:
Rafał Mikrut 2020-09-03 17:33:43 +02:00
parent 7eeff49426
commit 1ccaa91129
8 changed files with 1484 additions and 31 deletions

1472
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -3,4 +3,5 @@ members = [
"czkawka_core",
"czkawka_cli",
"czkawka_gui",
"czkawka_gui_orbtk",
]

View file

@ -22,7 +22,8 @@ It is in very early development, so most of the functions aren't added and doesn
- saving results to file
- support for * when excluding files and folders
- GUI(GTK)
- Files with debug symbols
- Alternative GUI with orbtk
- Finding files with debug symbols
- Support for showing only duplicates with specific extension, name(Regex support needed)
- Maybe windows support, but this will need some refactoring in code
@ -46,5 +47,18 @@ cargo run --bin czkawka_gui
cargo run --bin czkawka_cli
```
## How it works?
### Duplicate Finder
The only required parameter for checking duplicates is included folders `-i`. This parameter validates provided folders - which must have absolute path(without ~ and other similar symbols at the beginning), not contains *(wildcard), be dir(not file or symlink), exists. Later same things are done with excluded folders `-e`.
Next, this included and excluded folders are optimized due to tree structure of file system:
- Folders which contains another folders are combined(separately for included and excluded) - `/home/pulpet` and `/home/pulpet/a` are combined to `/home/pulpet`
- Inlcuded folders which are located inside excluded ones are delete - Included folder `/etc/tomcat/` is deleted because excluded folder is `/etc/`
- Non existed directories are removed
- Excluded path which are outside include path are deleted - Exclude path `/etc/` is removed if included path is `/home/`
If after optimization there is no include folders, then program ends with non zero value(TODO, this should be handled by returning value).
Next with provided by user minimal size of checked size `-s`, program checks requsively(TODO should be an option to turn off a recursion) included folders and checks files by sizes and put it files with same sizes to different boxes.
Next boxes which contains only one element are removed because files inside are not duplicated.
Next by default also is checked hash to get
## License
Czkawka is released under the terms of the GNU Lesser General Public License, version 2.1 or, at your option, any later version, as published by the Free Software Foundation.

View file

@ -181,6 +181,7 @@ Usage of Czkawka:
czkawka --d -i "/home/rafal/,/home/szczekacz" -e "/home/rafal/Pulpit,/home/rafal/Obrazy" -s 25 -x "7z,rar,IMAGE" -l "size" -delete
czkawka --d -i "/etc/,/mnt/Miecz" -s 1000 -x "VIDEO" -l "hash"
czkawka --d -i "/etc/" -delete "aeo"
--e <-i directory_to_search> [-e exclude_directories = ""] [-delete] - option to find and delete empty folders
-i directory_to_search - list of directories which should will be searched like /home/rafal
-e exclude_directories - list of directories which will be excluded from search.

View file

@ -156,7 +156,7 @@ impl DuplicateFinder {
continue;
}
// directory must end with /, due to possiblity of incorrect assumption, that e.g. /home/rafal is top folder to /home/rafalinho
// directory must end with /, due to possibility of incorrect assumption, that e.g. /home/rafal is top folder to /home/rafalinho
if !directory.ends_with('/') {
checked_directories.push(directory + "/");
} else {
@ -215,7 +215,7 @@ impl DuplicateFinder {
continue;
}
// directory must end with /, due to possiblity of incorrect assumption, that e.g. /home/rafal is top folder to /home/rafalinho
// directory must end with /, due to possibility of incorrect assumption, that e.g. /home/rafal is top folder to /home/rafalinho
if !directory.ends_with('/') {
checked_directories.push(directory.trim().to_string() + "/");
} else {
@ -259,7 +259,7 @@ impl DuplicateFinder {
// self.included_directories.clear();
// }
fn check_files_size(&mut self) {
// TODO maybe add multithread checking for file hash
// TODO maybe add multithreading checking for file hash
let start_time: SystemTime = SystemTime::now();
let mut folders_to_check: Vec<String> = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and
// big enough to store most of paths without needing to resize vector
@ -409,13 +409,13 @@ impl DuplicateFinder {
self.debug_print();
Common::print_time(start_time, SystemTime::now(), "check_files_hash".to_string());
}
// /// I'mm not sure about performance, so maybe I
// /// I'm not sure about performance, so maybe I
// pub fn find_small_duplicates_by_hashing(mut self){
// let start_time: SystemTime = SystemTime::now();
// let size_limit_for_small_files u64 = // 16 MB
// let mut new_hashmap
//
// Common::print_time(start_time, SystemTime::now(), "find_duplicates_by_comparting_begin_bytes_of_file".to_string());
// Common::print_time(start_time, SystemTime::now(), "find_duplicates_by_comparing_begin_bytes_of_file".to_string());
// }
/// Setting include directories, panics when there is not directories available

View file

@ -10,9 +10,11 @@ edition = "2018"
czkawka_core = { path = "../czkawka_core" }
gdk = "0.13.2"
gio = "0.9.1"
glib = "0.10.1"
[dependencies.gtk]
version = "0.9.2"
default-features = false # just in case
features = ["v3_18"]

View file

@ -0,0 +1,9 @@
[package]
name = "czkawka_gui_orbtk"
version = "0.1.0"
authors = ["Rafał Mikrut <mikrutrafal54@gmail.com>"]
edition = "2018"
[dependencies]
czkawka_core = { path = "../czkawka_core" }
orbtk = "=0.3.1-alpha3"

View file

@ -0,0 +1,4 @@
fn main() {
println!("Hello, world!");
println!("Orbtk frontend is still early WIP!");
}