Bug 749930 - Replace uses of nsILocalFile with nsIFile (more C++ bits); r=Neil

This commit is contained in:
Geoff Lankow 2012-06-21 19:33:49 +12:00
Родитель 648eed5d6e
Коммит d244bd899b
1 изменённых файлов: 4 добавлений и 16 удалений

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

@ -382,13 +382,9 @@ nsToolkitProfileService::Init()
rv = gDirServiceProvider->GetUserLocalDataDirectory(getter_AddRefs(mTempData)); rv = gDirServiceProvider->GetUserLocalDataDirectory(getter_AddRefs(mTempData));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> listFile; rv = mAppData->Clone(getter_AddRefs(mListFile));
rv = mAppData->Clone(getter_AddRefs(listFile));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
mListFile = do_QueryInterface(listFile);
NS_ENSURE_TRUE(listFile, NS_ERROR_NO_INTERFACE);
rv = mListFile->AppendNative(NS_LITERAL_CSTRING("profiles.ini")); rv = mListFile->AppendNative(NS_LITERAL_CSTRING("profiles.ini"));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -399,7 +395,7 @@ nsToolkitProfileService::Init()
} }
PRInt64 size; PRInt64 size;
rv = listFile->GetFileSize(&size); rv = mListFile->GetFileSize(&size);
if (NS_FAILED(rv) || !size) { if (NS_FAILED(rv) || !size) {
return NS_OK; return NS_OK;
} }
@ -727,15 +723,11 @@ nsToolkitProfileService::CreateProfileInternal(nsIFile* aRootDir,
nsCAutoString dirName; nsCAutoString dirName;
if (!rootDir) { if (!rootDir) {
nsCOMPtr<nsIFile> file; rv = gDirServiceProvider->GetUserProfilesRootDir(getter_AddRefs(rootDir),
rv = gDirServiceProvider->GetUserProfilesRootDir(getter_AddRefs(file),
aProfileName, aAppName, aProfileName, aAppName,
aVendorName); aVendorName);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rootDir = do_QueryInterface(file);
NS_ENSURE_TRUE(rootDir, NS_ERROR_UNEXPECTED);
dirName = aName; dirName = aName;
SaltProfileName(dirName); SaltProfileName(dirName);
@ -753,16 +745,12 @@ nsToolkitProfileService::CreateProfileInternal(nsIFile* aRootDir,
localDir = aRootDir; localDir = aRootDir;
} }
else { else {
nsCOMPtr<nsIFile> file; rv = gDirServiceProvider->GetUserProfilesLocalDir(getter_AddRefs(localDir),
rv = gDirServiceProvider->GetUserProfilesLocalDir(getter_AddRefs(file),
aProfileName, aProfileName,
aAppName, aAppName,
aVendorName); aVendorName);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
localDir = do_QueryInterface(file);
NS_ENSURE_TRUE(localDir, NS_ERROR_UNEXPECTED);
// use same salting // use same salting
if (NS_IsNativeUTF8()) { if (NS_IsNativeUTF8()) {
localDir->AppendNative(dirName); localDir->AppendNative(dirName);