diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 84f28267c..b43ed2650 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -150,7 +150,8 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool to = to + QLatin1String(".lnk"); #endif - if (QFile::exists(to)) + QFileInfo fileTo(to); + if (not fileTo.isSymLink() && fileTo.exists()) { if (replaceOnConflit) { @@ -161,6 +162,21 @@ void SymlinkCopyDirRecursive(const QString &fromDir, const QString &toDir, bool continue; } } + else if (fileTo.isSymLink()) + { + if (not fileTo.exists()) + { // automatically fix broken symlink + QFile::remove(to); + } + else if (replaceOnConflit) + { + QFile::remove(to); + } + else + { + continue; + } + } QFile::link(from, to); }