зеркало из https://github.com/mozilla/pjs.git
Added code that copies content from defaults folder
This commit is contained in:
Родитель
19b53ef7bf
Коммит
686c370100
|
@ -938,6 +938,13 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(char* charData)
|
||||||
printf("ProfileManagerData*** : %s\n", charData);
|
printf("ProfileManagerData*** : %s\n", charData);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
nsIFileLocator* locator = nsnull;
|
||||||
|
|
||||||
|
rv = nsServiceManager::GetService(kFileLocatorCID, nsIFileLocator::GetIID(), (nsISupports**)&locator);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv) || !locator)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsString data(charData);
|
nsString data(charData);
|
||||||
|
|
||||||
// Set the gathered info into an array
|
// Set the gathered info into an array
|
||||||
|
@ -958,24 +965,16 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(char* charData)
|
||||||
if (!dirName || !*dirName)
|
if (!dirName || !*dirName)
|
||||||
{
|
{
|
||||||
// They didn't type a directory path...
|
// They didn't type a directory path...
|
||||||
nsIFileLocator* locator = nsnull;
|
|
||||||
|
|
||||||
rv = nsServiceManager::GetService(kFileLocatorCID, nsIFileLocator::GetIID(), (nsISupports**)&locator);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv) || !locator)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// Get current profile, make the new one a sibling...
|
// Get current profile, make the new one a sibling...
|
||||||
nsIFileSpec* horribleCOMDirSpecThing;
|
nsIFileSpec* horribleCOMDirSpecThing;
|
||||||
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, &horribleCOMDirSpecThing);
|
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, &horribleCOMDirSpecThing);
|
||||||
|
|
||||||
nsServiceManager::ReleaseService(kFileLocatorCID, locator);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv) || !horribleCOMDirSpecThing)
|
if (NS_FAILED(rv) || !horribleCOMDirSpecThing)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
//Append profile name to form a directory name
|
//Append profile name to form a directory name
|
||||||
horribleCOMDirSpecThing->GetFileSpec(&dirSpec);
|
horribleCOMDirSpecThing->GetFileSpec(&dirSpec);
|
||||||
|
NS_RELEASE(horribleCOMDirSpecThing);
|
||||||
//dirSpec.SetLeafName(profileName);
|
//dirSpec.SetLeafName(profileName);
|
||||||
dirSpec += profileName;
|
dirSpec += profileName;
|
||||||
}
|
}
|
||||||
|
@ -997,6 +996,23 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(char* charData)
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
// Get profile defaults folder..
|
||||||
|
nsIFileSpec* profDefaultsDir;
|
||||||
|
rv = locator->GetFileLocation(nsSpecialFileSpec::App_ProfileDefaultsFolder50, &profDefaultsDir);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv) || !profDefaultsDir)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsFileSpec defaultsDirSpec;
|
||||||
|
|
||||||
|
profDefaultsDir->GetFileSpec(&defaultsDirSpec);
|
||||||
|
NS_RELEASE(profDefaultsDir);
|
||||||
|
|
||||||
|
// Copy contents from defaults folder.
|
||||||
|
defaultsDirSpec.RecursiveCopy(dirSpec);
|
||||||
|
|
||||||
|
nsServiceManager::ReleaseService(kFileLocatorCID, locator);
|
||||||
|
|
||||||
if (dirName)
|
if (dirName)
|
||||||
{
|
{
|
||||||
PR_DELETE(dirName);
|
PR_DELETE(dirName);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче