Use FS::move instead; check new config does not exist
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
@@ -103,15 +103,16 @@ void ResourceDownloadTask::downloadSucceeded()
|
|||||||
|
|
||||||
// also rename the shader config file
|
// also rename the shader config file
|
||||||
if (dynamic_cast<ShaderPackFolderModel*>(m_pack_model.get()) != nullptr) {
|
if (dynamic_cast<ShaderPackFolderModel*>(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()) {
|
if (oldConfig.exists() && !newConfig.exists()) {
|
||||||
QString src = config.filePath();
|
bool success = FS::move(oldConfig.filePath(), newConfig.filePath());
|
||||||
QString dest = m_targetPath + ".txt";
|
|
||||||
bool success = QFile::rename(src, dest);
|
|
||||||
|
|
||||||
if (!success)
|
if (!success) {
|
||||||
emit logWarning(tr("Failed to rename shader config '%1' to '%2'").arg(src, dest));
|
emit logWarning(
|
||||||
|
tr("Failed to rename shader config from '%1' to '%2'").arg(oldConfig.absoluteFilePath(), newConfig.absoluteFilePath()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user