Properly migrate the existing profiles
Make sure that the default profile (including all its generations) are still available after we move it to the user’s home directory
This commit is contained in:
@@ -305,11 +305,16 @@ Path getDefaultProfile()
|
||||
if (!pathExists(profileLink)
|
||||
|| (isLink(profileLink)
|
||||
&& readLink(profileLink) == legacyProfile)) {
|
||||
warn("Migrating the default profile");
|
||||
replaceSymlink(newProfile, profileLink);
|
||||
for (auto & oldGen : findGenerations(legacyProfile).first) {
|
||||
replaceSymlink(
|
||||
oldGen.path,
|
||||
newProfile + "/" + std::string(baseNameOf(oldGen.path)));
|
||||
replaceSymlink(legacyProfile, newProfile);
|
||||
if (pathExists(legacyProfile)) {
|
||||
for (auto & oldGen : findGenerations(legacyProfile).first) {
|
||||
replaceSymlink(
|
||||
oldGen.path,
|
||||
dirOf(newProfile) + "/"
|
||||
+ std::string(baseNameOf(oldGen.path)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return absPath(readLink(profileLink), dirOf(profileLink));
|
||||
|
||||
Reference in New Issue
Block a user