mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 364521 - Need a bundleIdentifier attribute in nsILocalFileMac. r=mento, sr=pink.
This commit is contained in:
parent
425b7c9aef
commit
177a1e40ad
@ -51,7 +51,7 @@
|
||||
[ptr] native FSRefPtr(FSRef);
|
||||
native CFURLRef(CFURLRef);
|
||||
|
||||
[scriptable, uuid(FC93A109-7BF2-4CEF-B283-2E973E5DCF7E)]
|
||||
[scriptable, uuid(748f3ffe-27d9-4402-9de9-494badbeebf4)]
|
||||
interface nsILocalFileMac : nsILocalFile
|
||||
{
|
||||
/**
|
||||
@ -237,6 +237,13 @@ interface nsILocalFileMac : nsILocalFile
|
||||
* readable name of the application)
|
||||
*/
|
||||
readonly attribute AString bundleDisplayName;
|
||||
|
||||
/**
|
||||
* bundleIdentifier
|
||||
*
|
||||
* returns the identifier of the bundle
|
||||
*/
|
||||
readonly attribute AUTF8String bundleIdentifier;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -2016,6 +2016,28 @@ nsLocalFile::GetBundleDisplayName(nsAString& outBundleName)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
CFURLRef urlRef;
|
||||
if (NS_SUCCEEDED(GetCFURL(&urlRef))) {
|
||||
CFBundleRef bundle = ::CFBundleCreate(NULL, urlRef);
|
||||
if (bundle) {
|
||||
CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(bundle);
|
||||
if (bundleIdentifier)
|
||||
rv = CFStringReftoUTF8(bundleIdentifier, outBundleIdentifier);
|
||||
|
||||
::CFRelease(bundle);
|
||||
}
|
||||
::CFRelease(urlRef);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// nsLocalFile Methods
|
||||
//*****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user