Compare commits
2 commits
b7fc64a3a5
...
cf0aa33314
Author | SHA1 | Date | |
---|---|---|---|
cf0aa33314 | |||
e952225ec6 |
1 changed files with 3 additions and 8 deletions
11
src/main.rs
11
src/main.rs
|
@ -91,10 +91,9 @@ fn main() {
|
||||||
let mut thread_pool: Vec<thread::JoinHandle<()>> = Vec::new();
|
let mut thread_pool: Vec<thread::JoinHandle<()>> = Vec::new();
|
||||||
|
|
||||||
for selection in actual_selection {
|
for selection in actual_selection {
|
||||||
// TODO: forget the assumption that the user won't try to sort like 100 dirs at the same
|
let thread = thread::spawn(move || match sort_files(selection, false) {
|
||||||
// time
|
Ok(_) => {}
|
||||||
let thread = thread::spawn(move || {
|
Err(err) => eprintln!("{}", err),
|
||||||
let _ = sort_files(selection, false); // TODO: handle errors
|
|
||||||
});
|
});
|
||||||
|
|
||||||
thread_pool.push(thread);
|
thread_pool.push(thread);
|
||||||
|
@ -107,16 +106,12 @@ fn main() {
|
||||||
|
|
||||||
// TODO: implement recuriveness
|
// TODO: implement recuriveness
|
||||||
fn sort_files(selection: String, _recursive: bool) -> Result<(), Box<dyn std::error::Error>> {
|
fn sort_files(selection: String, _recursive: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
println!("Sorting {}", selection);
|
|
||||||
|
|
||||||
let search_path = CONFIG
|
let search_path = CONFIG
|
||||||
.get()
|
.get()
|
||||||
.and_then(|config| config.sources.get(&selection))
|
.and_then(|config| config.sources.get(&selection))
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
println!("Searching in {}", search_path.display());
|
|
||||||
|
|
||||||
let dir = fs::read_dir(search_path)?;
|
let dir = fs::read_dir(search_path)?;
|
||||||
|
|
||||||
let file_types = [
|
let file_types = [
|
||||||
|
|
Loading…
Reference in a new issue