diff --git a/src/common/utility_win.cpp b/src/common/utility_win.cpp index 7c0fe43562..7c42a91ff0 100644 --- a/src/common/utility_win.cpp +++ b/src/common/utility_win.cpp @@ -190,9 +190,6 @@ QString Utility::syncFolderDisplayName(const QString ¤tDisplayName, const void Utility::migrateFavLink(const QString &folder) { - //overwrite Desktop.ini, update icon - setupDesktopIni(folder, true); - const QDir folderDir(QDir::fromNativeSeparators(folder)); const auto oldDirName = folderDir.dirName(); const auto nextcloud = QStringLiteral("Nextcloud"); @@ -201,6 +198,16 @@ void Utility::migrateFavLink(const QString &folder) return; } + const auto folderDisplayName = syncFolderDisplayName(oldDirName, QStringLiteral(APPLICATION_NAME)); + // overwrite Desktop.ini, update icon, update folder display name + setupDesktopIni(folder, true); + QFile desktopIni(folder + QLatin1String("/Desktop.ini")); + desktopIni.open(QFile::WriteOnly); + desktopIni.write("\r\nLocalizedResourceName="); + desktopIni.write(folderDisplayName.toUtf8()); + desktopIni.write("\r\n"); + desktopIni.close(); + const auto pathToLinks = systemPathToLinks(); if (pathToLinks.isEmpty()) { qCWarning(lcUtility) << "SHGetKnownFolderPath for links has failed."; @@ -209,7 +216,7 @@ void Utility::migrateFavLink(const QString &folder) const QDir dirPathToLinks(pathToLinks); const auto oldLnkFilename = dirPathToLinks.filePath(oldDirName + QLatin1String(".lnk")); - const auto newLnkFilename = dirPathToLinks.filePath(syncFolderDisplayName(oldDirName, QStringLiteral(APPLICATION_NAME)) + QLatin1String(".lnk")); + const auto newLnkFilename = dirPathToLinks.filePath(folderDisplayName + QLatin1String(".lnk")); if (QFile::exists(newLnkFilename)) { qCWarning(lcUtility) << "New lnk file already exists" << newLnkFilename;