diff --git a/crates/symsorter/src/app.rs b/crates/symsorter/src/app.rs index 4dbd4ace8..73fd6d226 100644 --- a/crates/symsorter/src/app.rs +++ b/crates/symsorter/src/app.rs @@ -157,7 +157,21 @@ fn process_file( style(obj.arch()).yellow(), style(new_filename.display()).cyan(), ); - let mut out = fs::File::create(&new_filename)?; + + let mut out = match fs::File::create_new(&new_filename) { + Ok(out) => out, + Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => { + eprintln!( + "{}: File {} already exists, you seem to have duplicate debug files for ID {}.\n\ + Skipping {filename}.", + style("WARNING").red().bold(), + new_filename.display(), + get_unified_id(&obj).unwrap(), + ); + return Ok(vec![]); + } + Err(e) => return Err(e.into()), + }; if compression_level > 0 { copy_encode(obj.data(), &mut out, compression_level)?;