Bug 364521 - Need a bundleIdentifier attribute in nsILocalFileMac. r=mento, sr=pink.

This commit is contained in:
mozilla.mano%sent.com 2006-12-23 20:17:29 +00:00
parent 425b7c9aef
commit 177a1e40ad
2 changed files with 30 additions and 1 deletions

View File

@ -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++

View File

@ -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
//*****************************************************************************