File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -35,4 +35,5 @@ extern {
3535 pub fn CFBundleCopyPrivateFrameworksURL ( bundle : CFBundleRef ) -> CFURLRef ;
3636 pub fn CFBundleCopySharedSupportURL ( bundle : CFBundleRef ) -> CFURLRef ;
3737 pub fn CFBundleCopyBundleURL ( bundle : CFBundleRef ) -> CFURLRef ;
38+ pub fn CFBundleCopyResourcesDirectoryURL ( bundle : CFBundleRef ) -> CFURLRef ;
3839}
Original file line number Diff line number Diff line change @@ -99,6 +99,24 @@ impl CFBundle {
9999 Some ( PathBuf :: from ( url. get_file_system_path ( kCFURLPOSIXPathStyle) . to_string ( ) ) )
100100 }
101101
102+ /// Bundle's resources location
103+ pub fn bundle_resources_url ( & self ) -> Option < CFURL > {
104+ unsafe {
105+ let bundle_url = CFBundleCopyResourcesDirectoryURL ( self . 0 ) ;
106+ if bundle_url. is_null ( ) {
107+ None
108+ } else {
109+ Some ( TCFType :: wrap_under_create_rule ( bundle_url) )
110+ }
111+ }
112+ }
113+
114+ /// Bundle's resources location
115+ pub fn resources_path ( & self ) -> Option < PathBuf > {
116+ let url = self . bundle_resources_url ( ) ?;
117+ Some ( PathBuf :: from ( url. get_file_system_path ( kCFURLPOSIXPathStyle) . to_string ( ) ) )
118+ }
119+
102120 pub fn private_frameworks_url ( & self ) -> Option < CFURL > {
103121 unsafe {
104122 let fw_url = CFBundleCopyPrivateFrameworksURL ( self . 0 ) ;
You can’t perform that action at this time.
0 commit comments