@@ -614,11 +614,7 @@ impl CustomDebugInfoParser for PDBParser {
614614 potential_path. pop ( ) ;
615615 potential_path. push ( & info. file_name ) ;
616616 if potential_path. exists ( ) {
617- match fs:: read (
618- potential_path
619- . to_str ( )
620- . expect ( "Potential path is a real string" ) ,
621- ) {
617+ match fs:: read ( potential_path) {
622618 Ok ( conts) => match self
623619 . load_from_file ( & conts, debug_info, view, & progress, true , false )
624620 {
@@ -631,6 +627,35 @@ impl CustomDebugInfoParser for PDBParser {
631627 }
632628 }
633629
630+ // Try in the same folder in the project
631+ if let Some ( project_file) = view. file ( ) . project_file ( ) {
632+ let project_file_folder_id = project_file. folder ( ) . map ( |x| x. id ( ) ) ;
633+ for file in project_file. project ( ) . files ( ) . iter ( ) {
634+ let file_folder_id = file. folder ( ) . map ( |x| x. id ( ) ) ;
635+ if file. name ( ) == info. file_name && file_folder_id == project_file_folder_id {
636+ if !file. exists_on_disk ( ) {
637+ // If the file doesn't exist, don't consider it
638+ // TODO: if we're connected to a remote project, offer to download the file
639+ continue ;
640+ }
641+
642+ if let Some ( path_on_disk) = file. path_on_disk ( ) {
643+ match fs:: read ( path_on_disk) {
644+ Ok ( conts) => match self . load_from_file (
645+ & conts, debug_info, view, & progress, true , false ,
646+ ) {
647+ Ok ( _) => return true ,
648+ Err ( e) if e. to_string ( ) == "Cancelled" => return false ,
649+ Err ( e) => debug ! ( "Skipping, {}" , e. to_string( ) ) ,
650+ } ,
651+ Err ( e) if e. to_string ( ) == "Cancelled" => return false ,
652+ Err ( e) => debug ! ( "Could not read pdb: {}" , e. to_string( ) ) ,
653+ }
654+ }
655+ }
656+ }
657+ }
658+
634659 // Check the local symbol store
635660 if let Ok ( local_store_path) = active_local_cache ( Some ( view) ) {
636661 match search_sym_store ( view, local_store_path. clone ( ) , & info) {
0 commit comments