summaryrefslogtreecommitdiffstats
path: root/toolkit/xre/ProfileReset.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-19 19:49:01 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-19 19:49:01 +0200
commit8b960b23ac31d4dd0763f91ab5f494251467eeb1 (patch)
treef9300c10b6d6541752450385a9e30a4f6ed42c56 /toolkit/xre/ProfileReset.cpp
parent585c1ec4b27beb1d54606b8451d60ab56bc11a18 (diff)
downloadUXP-8b960b23ac31d4dd0763f91ab5f494251467eeb1.tar
UXP-8b960b23ac31d4dd0763f91ab5f494251467eeb1.tar.gz
UXP-8b960b23ac31d4dd0763f91ab5f494251467eeb1.tar.lz
UXP-8b960b23ac31d4dd0763f91ab5f494251467eeb1.tar.xz
UXP-8b960b23ac31d4dd0763f91ab5f494251467eeb1.zip
moebius#205: Fix: The profile - resetting (the custom profile name)
https://github.com/MoonchildProductions/moebius/pull/205
Diffstat (limited to 'toolkit/xre/ProfileReset.cpp')
-rw-r--r--toolkit/xre/ProfileReset.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp
index aef2d7746..c9e2ef8d4 100644
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -31,13 +31,19 @@ static const char kProfileProperties[] =
* Creates a new profile with a timestamp in the name to use for profile reset.
*/
nsresult
-CreateResetProfile(nsIToolkitProfileService* aProfileSvc, nsIToolkitProfile* *aNewProfile)
+CreateResetProfile(nsIToolkitProfileService* aProfileSvc, const nsACString& aOldProfileName, nsIToolkitProfile* *aNewProfile)
{
MOZ_ASSERT(aProfileSvc, "NULL profile service");
nsCOMPtr<nsIToolkitProfile> newProfile;
- // Make the new profile "default-" + the time in seconds since epoch for uniqueness.
- nsAutoCString newProfileName("default-");
+ // Make the new profile the old profile (or "default-") + the time in seconds since epoch for uniqueness.
+ nsAutoCString newProfileName;
+ if (!aOldProfileName.IsEmpty()) {
+ newProfileName.Assign(aOldProfileName);
+ newProfileName.Append("-");
+ } else {
+ newProfileName.Assign("default-");
+ }
newProfileName.Append(nsPrintfCString("%lld", PR_Now() / 1000));
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
newProfileName,