diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index 57884a27f124..be775ec9e1b3 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -1198,7 +1198,24 @@ nsProfile::RenameProfile(const PRUnichar* oldName, const PRUnichar* newName) // Delete old profile entry rv = DeleteProfile(oldName, PR_FALSE /* don't delete files */); if (NS_FAILED(rv)) return rv; - + + /* note, we do not rename the dir on disk to the new name + * we don't rename the directory on purpose. + * we don't require the directory name to match the profile name, + * but it usually does. + * (the pairing of values occurs in the profile registry) + * + * Imagine this scenario: + * 1) user creates a profile "foo" and the directory gets named "foo". + * 2) user creates a profile "bar" and the directory gets named "bar" + * 3) user deletes the profile "foo", but chooses not to delete the files on disk. (they are given this option when deleting a profile) + * 4) user renames "bar" profile to "foo" + * + * things would not work correctly if we renamed the folder on disk. + * for completeness: + * if the user now creates another new profile named "foo", the folder on disk will have a unique name on disk, probably "foo-1". + */ + /* profile is just replaced. But Keep up the count */ gProfileDataAccess->mNumProfiles++;