forked from qt-creator/qt-creator
QmlDesigner: Skip imported files that already exist and are the same
When importing files to project, if the target file already exists and has the same modified timestamp, silently skip copying the file instead of asking if it should be overwritten. Fixes: QDS-8402 Change-Id: If963e997c6bcfb3e46db6e74c46081784bdddc7e Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -1051,7 +1051,11 @@ AddFilesResult addFilesToProject(const QStringList &fileNames, const QString &de
|
|||||||
QStringList removeList;
|
QStringList removeList;
|
||||||
for (const QString &fileName : fileNames) {
|
for (const QString &fileName : fileNames) {
|
||||||
const QString targetFile = directory + "/" + QFileInfo(fileName).fileName();
|
const QString targetFile = directory + "/" + QFileInfo(fileName).fileName();
|
||||||
if (QFileInfo::exists(targetFile)) {
|
Utils::FilePath srcFilePath = Utils::FilePath::fromString(fileName);
|
||||||
|
Utils::FilePath targetFilePath = Utils::FilePath::fromString(targetFile);
|
||||||
|
if (targetFilePath.exists()) {
|
||||||
|
if (srcFilePath.lastModified() == targetFilePath.lastModified())
|
||||||
|
continue;
|
||||||
const QString title = QCoreApplication::translate(
|
const QString title = QCoreApplication::translate(
|
||||||
"ModelNodeOperations", "Overwrite Existing File?");
|
"ModelNodeOperations", "Overwrite Existing File?");
|
||||||
const QString question = QCoreApplication::translate(
|
const QString question = QCoreApplication::translate(
|
||||||
|
Reference in New Issue
Block a user