Remove unused code from ToolkitProfileService
This commit is contained in:
parent
acaad7bf66
commit
f1309924dd
|
@ -68,29 +68,6 @@ interface nsIToolkitProfileService : nsISupports
|
|||
nsIToolkitProfile createProfile(in nsIFile aRootDir,
|
||||
in AUTF8String aName);
|
||||
|
||||
/**
|
||||
* Create the default profile for an application.
|
||||
*
|
||||
* The profile will be typically in
|
||||
* {Application Data}/.profilename/{salt}.default or
|
||||
* {Application Data}/.appname/{salt}.default
|
||||
* or if aVendorName is provided
|
||||
* {Application Data}/.vendor/appname/{salt}.default
|
||||
*
|
||||
* @note Either aProfileName or aAppName must be non-empty
|
||||
*
|
||||
* @param aProfileName
|
||||
* The name of the profile
|
||||
* @param aAppName
|
||||
* The name of the application
|
||||
* @param aVendorName
|
||||
* The name of the vendor
|
||||
* @return The created profile.
|
||||
*/
|
||||
nsIToolkitProfile createDefaultProfileForApp(in AUTF8String aProfileName,
|
||||
in AUTF8String aAppName,
|
||||
in AUTF8String aVendorName);
|
||||
|
||||
/**
|
||||
* Returns the number of profiles.
|
||||
* @return 0, 1, or 2. More than 2 profiles will always return 2.
|
||||
|
|
|
@ -714,71 +714,6 @@ static void SaltProfileName(nsACString& aName)
|
|||
aName.Insert(salt, 0, 9);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileService::CreateDefaultProfileForApp(const nsACString& aProfileName,
|
||||
const nsACString& aAppName,
|
||||
const nsACString& aVendorName,
|
||||
nsIToolkitProfile** aResult)
|
||||
{
|
||||
NS_ENSURE_STATE(!aProfileName.IsEmpty() || !aAppName.IsEmpty());
|
||||
nsCOMPtr<nsIFile> appData;
|
||||
nsresult rv =
|
||||
gDirServiceProvider->GetUserDataDirectory(getter_AddRefs(appData),
|
||||
false,
|
||||
&aProfileName,
|
||||
&aAppName,
|
||||
&aVendorName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> profilesini;
|
||||
appData->Clone(getter_AddRefs(profilesini));
|
||||
rv = profilesini->AppendNative(NS_LITERAL_CSTRING("profiles.ini"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool exists = false;
|
||||
profilesini->Exists(&exists);
|
||||
NS_ENSURE_FALSE(exists, NS_ERROR_ALREADY_INITIALIZED);
|
||||
|
||||
rv = CreateProfileInternal(nullptr,
|
||||
NS_LITERAL_CSTRING("default"),
|
||||
&aProfileName, &aAppName, &aVendorName,
|
||||
true, aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_STATE(*aResult);
|
||||
|
||||
nsCOMPtr<nsIFile> rootDir;
|
||||
(*aResult)->GetRootDir(getter_AddRefs(rootDir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString profileDir;
|
||||
rv = rootDir->GetRelativeDescriptor(appData, profileDir);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString ini;
|
||||
ini.SetCapacity(512);
|
||||
ini.AppendLiteral("[General]\n");
|
||||
ini.AppendLiteral("StartWithLastProfile=1\n\n");
|
||||
|
||||
ini.AppendLiteral("[Profile0]\n");
|
||||
ini.AppendLiteral("Name=default\n");
|
||||
ini.AppendLiteral("IsRelative=1\n");
|
||||
ini.AppendLiteral("Path=");
|
||||
ini.Append(profileDir);
|
||||
ini.Append('\n');
|
||||
ini.AppendLiteral("Default=1\n\n");
|
||||
|
||||
FILE* writeFile;
|
||||
rv = profilesini->OpenANSIFileDesc("w", &writeFile);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (fwrite(ini.get(), sizeof(char), ini.Length(), writeFile) !=
|
||||
ini.Length()) {
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
fclose(writeFile);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileService::CreateProfile(nsIFile* aRootDir,
|
||||
const nsACString& aName,
|
||||
|
|
Loading…
Reference in New Issue