Skip to content

Commit

Permalink
Fixing bugs releated to parent dir creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbor committed Jul 6, 2022
1 parent 14c0b75 commit 4f05d84
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ const RAW_EXTENSIONS: [&'static str; 1] = [
"CR2",
];

const IMG_EXTENSIONS: [&'static str; 4] = [
const IMG_EXTENSIONS: [&'static str; 8] = [
"jpg", "jpeg", "png", "tiff",
"JPG", "JPEG", "PNG", "TIFF",
];


Expand Down Expand Up @@ -373,8 +374,9 @@ fn main() {

if output_pathbuf.parent().is_some() && !output_pathbuf.parent().unwrap().exists() {
let parent = output_pathbuf.parent().unwrap();
if fs::create_dir(&parent).is_err() {
if fs::create_dir_all(&parent).is_err() {
println!("Unable to create dir {:?} as parent for {:?}", parent, output_pathbuf);
err_counter += 1;
continue;
}
}
Expand Down Expand Up @@ -413,7 +415,10 @@ fn main() {

match file_kind(file) {
FileKind::Raw => match args.raws {
ParsableAction::Ignore => ignored_counter += 1,
ParsableAction::Ignore => {
println!("Ignoring {:?}", file);
ignored_counter += 1;
},
ParsableAction::Parse =>
match recode(file.as_path(), output_path, encoder) {
Some((dtime, etime)) => {
Expand All @@ -436,7 +441,10 @@ fn main() {
},
},
FileKind::Image => match args.images {
UnparsableAction::Ignore => ignored_counter += 1,
UnparsableAction::Ignore => {
println!("Ignoring {:?}", file);
ignored_counter += 1;
},
UnparsableAction::Copy =>
match copy(file.as_path(), output_path) {
Some(ctime) => { copy_time += ctime; copy_counter += 1 },
Expand All @@ -449,7 +457,10 @@ fn main() {
},
},
FileKind::Other => match args.files {
UnparsableAction::Ignore => ignored_counter += 1,
UnparsableAction::Ignore => {
println!("Ignoring {:?}", file);
ignored_counter += 1;
},
UnparsableAction::Copy =>
match copy(file.as_path(), output_path) {
Some(ctime) => { copy_time += ctime; copy_counter += 1 },
Expand Down

0 comments on commit 4f05d84

Please sign in to comment.