From 2477c4f021a9cc4b9fd8ba518efaeb746b7af01b Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 9 Dec 2025 11:04:01 +0000 Subject: [PATCH] Use FS::move instead; check new config does not exist Signed-off-by: TheKodeToad --- launcher/ResourceDownloadTask.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/launcher/ResourceDownloadTask.cpp b/launcher/ResourceDownloadTask.cpp index c5d9a7c67..89d09b9b3 100644 --- a/launcher/ResourceDownloadTask.cpp +++ b/launcher/ResourceDownloadTask.cpp @@ -103,15 +103,16 @@ void ResourceDownloadTask::downloadSucceeded() // also rename the shader config file if (dynamic_cast(m_pack_model.get()) != nullptr) { - QFileInfo config(m_pack_model->dir(), filename + ".txt"); + QFileInfo oldConfig(m_pack_model->dir(), filename + ".txt"); + QFileInfo newConfig(m_targetPath + ".txt"); - if (config.exists()) { - QString src = config.filePath(); - QString dest = m_targetPath + ".txt"; - bool success = QFile::rename(src, dest); + if (oldConfig.exists() && !newConfig.exists()) { + bool success = FS::move(oldConfig.filePath(), newConfig.filePath()); - if (!success) - emit logWarning(tr("Failed to rename shader config '%1' to '%2'").arg(src, dest)); + if (!success) { + emit logWarning( + tr("Failed to rename shader config from '%1' to '%2'").arg(oldConfig.absoluteFilePath(), newConfig.absoluteFilePath())); + } } } }