Commit 437be24 1 parent d2ff402 commit 437be24 Copy full SHA for 437be24
File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -35,4 +35,5 @@ extern {
35
35
pub fn CFBundleCopyPrivateFrameworksURL ( bundle : CFBundleRef ) -> CFURLRef ;
36
36
pub fn CFBundleCopySharedSupportURL ( bundle : CFBundleRef ) -> CFURLRef ;
37
37
pub fn CFBundleCopyBundleURL ( bundle : CFBundleRef ) -> CFURLRef ;
38
+ pub fn CFBundleCopyResourcesDirectoryURL ( bundle : CFBundleRef ) -> CFURLRef ;
38
39
}
Original file line number Diff line number Diff line change @@ -99,6 +99,24 @@ impl CFBundle {
99
99
Some ( PathBuf :: from ( url. get_file_system_path ( kCFURLPOSIXPathStyle) . to_string ( ) ) )
100
100
}
101
101
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
+
102
120
pub fn private_frameworks_url ( & self ) -> Option < CFURL > {
103
121
unsafe {
104
122
let fw_url = CFBundleCopyPrivateFrameworksURL ( self . 0 ) ;
You can’t perform that action at this time.
0 commit comments