File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use binaryninjacore_sys::{
99 BNProjectFileSetFolder , BNProjectFileSetName ,
1010} ;
1111use std:: fmt:: Debug ;
12- use std:: path:: Path ;
12+ use std:: path:: { Path , PathBuf } ;
1313use std:: ptr:: { null_mut, NonNull } ;
1414use std:: time:: SystemTime ;
1515
@@ -37,8 +37,13 @@ impl ProjectFile {
3737 }
3838
3939 /// Get the path on disk to this file's contents
40- pub fn path_on_disk ( & self ) -> String {
41- unsafe { BnString :: into_string ( BNProjectFileGetPathOnDisk ( self . handle . as_ptr ( ) ) ) }
40+ pub fn path_on_disk ( & self ) -> Option < PathBuf > {
41+ if !self . exists_on_disk ( ) {
42+ return None ;
43+ }
44+ let path_str =
45+ unsafe { BnString :: into_string ( BNProjectFileGetPathOnDisk ( self . handle . as_ptr ( ) ) ) } ;
46+ Some ( PathBuf :: from ( path_str) )
4247 }
4348
4449 /// Check if this file's contents exist on disk
You can’t perform that action at this time.
0 commit comments