|
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | | -use std::ffi::OsStr; |
16 | | -use std::path::{Path, PathBuf}; |
| 15 | +use std::path::PathBuf; |
17 | 16 | use std::{str::FromStr, sync::mpsc}; |
18 | 17 |
|
19 | 18 | use crate::{DebugInfoBuilderContext, ReaderType}; |
@@ -590,10 +589,8 @@ pub(crate) fn find_sibling_debug_file(view: &BinaryView) -> Option<String> { |
590 | 589 | return None; |
591 | 590 | } |
592 | 591 |
|
593 | | - let full_file_path = view.file().filename().to_string(); |
594 | | - |
595 | | - let debug_file = PathBuf::from(format!("{}.debug", full_file_path)); |
596 | | - let dsym_folder = PathBuf::from(format!("{}.dSYM", full_file_path)); |
| 592 | + let debug_file = view.file().file_path().with_extension("debug"); |
| 593 | + let dsym_folder = view.file().file_path().with_extension("dSYM"); |
597 | 594 |
|
598 | 595 | // Find sibling debug file |
599 | 596 | if debug_file.exists() && debug_file.is_file() { |
@@ -624,13 +621,12 @@ pub(crate) fn find_sibling_debug_file(view: &BinaryView) -> Option<String> { |
624 | 621 | // Look for dSYM |
625 | 622 | // TODO: look for dSYM in project |
626 | 623 | if dsym_folder.exists() && dsym_folder.is_dir() { |
627 | | - let filename = Path::new(&full_file_path) |
628 | | - .file_name() |
629 | | - .unwrap_or(OsStr::new("")); |
630 | | - |
631 | | - let dsym_file = dsym_folder.join("Contents/Resources/DWARF/").join(filename); // TODO: should this just pull any file out? Can there be multiple files? |
632 | | - if dsym_file.exists() { |
633 | | - return Some(dsym_file.to_string_lossy().to_string()); |
| 624 | + if let Some(filename) = view.file().file_path().file_name() { |
| 625 | + // TODO: should this just pull any file out? Can there be multiple files? |
| 626 | + let dsym_file = dsym_folder.join("Contents/Resources/DWARF/").join(filename); |
| 627 | + if dsym_file.exists() { |
| 628 | + return Some(dsym_file.to_string_lossy().to_string()); |
| 629 | + } |
634 | 630 | } |
635 | 631 | } |
636 | 632 |
|
|
0 commit comments