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
Родитель 3e6ec2f063
Коммит 5751adf0ba
2 изменённых файлов: 30 добавлений и 1 удалений

Просмотреть файл

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