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