From 1a0e69872a991d5e4a2c2fb269a51ed3aba351bc Mon Sep 17 00:00:00 2001 From: Eike Siewertsen Date: Mon, 5 Aug 2019 10:50:58 +0200 Subject: [PATCH] add shared_support_url to CFBundle --- core-foundation-sys/src/bundle.rs | 1 + core-foundation/src/bundle.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/core-foundation-sys/src/bundle.rs b/core-foundation-sys/src/bundle.rs index 687b00e..b4045d0 100644 --- a/core-foundation-sys/src/bundle.rs +++ b/core-foundation-sys/src/bundle.rs @@ -33,4 +33,5 @@ extern { pub fn CFBundleGetTypeID() -> CFTypeID; pub fn CFBundleCopyExecutableURL(bundle: CFBundleRef) -> CFURLRef; pub fn CFBundleCopyPrivateFrameworksURL(bundle: CFBundleRef) -> CFURLRef; + pub fn CFBundleCopySharedSupportURL(bundle: CFBundleRef) -> CFURLRef; } diff --git a/core-foundation/src/bundle.rs b/core-foundation/src/bundle.rs index f23f9ae..7d051ff 100644 --- a/core-foundation/src/bundle.rs +++ b/core-foundation/src/bundle.rs @@ -89,6 +89,17 @@ impl CFBundle { } } } + + pub fn shared_support_url(&self) -> Option { + unsafe { + let fw_url = CFBundleCopySharedSupportURL(self.0); + if fw_url.is_null() { + None + } else { + Some(TCFType::wrap_under_create_rule(fw_url)) + } + } + } }