Skip to content

Commit

Permalink
Error handling for target path
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoheiu committed Jan 19, 2024
1 parent 572802f commit 67e1367
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ fn main() -> Result<(), errors::FxError> {
}
_ => {
if args[1].starts_with("--choosefiles=") {
let target_path = PathBuf::from(args[1].split('=').nth(1).unwrap());
if let Err(e) = run::run(
std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")),
false,
Some(target_path),
) {
eprintln!("{}", e);
if let Some(target_path) = args[1].split('=').nth(1) {
if let Err(e) = run::run(
std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")),
false,
Some(PathBuf::from(target_path)),
) {
eprintln!("{}", e);
}
} else {
eprintln!("Cannot read target file path.");
}
} else if let Err(e) = run::run(PathBuf::from(&args[1]), false, None) {
eprintln!("{}", e);
Expand Down

0 comments on commit 67e1367

Please sign in to comment.