From f2026df597c2cb6213a598bfaecdbfb700849a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 16 May 2015 16:09:34 +0200 Subject: GH-952 do not remove {version,custom}.json files, rename them --- logic/minecraft/OneSixProfileStrategy.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/logic/minecraft/OneSixProfileStrategy.cpp b/logic/minecraft/OneSixProfileStrategy.cpp index 389b5f06..a84f0387 100644 --- a/logic/minecraft/OneSixProfileStrategy.cpp +++ b/logic/minecraft/OneSixProfileStrategy.cpp @@ -22,13 +22,13 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles() auto mcJson = PathCombine(m_instance->instanceRoot(), "patches" , "net.minecraft.json"); QString sourceFile; - QString deleteFile; + QString renameFile; // convert old crap. if(QFile::exists(customJsonPath)) { sourceFile = customJsonPath; - deleteFile = versionJsonPath; + renameFile = versionJsonPath; } else if(QFile::exists(versionJsonPath)) { @@ -41,11 +41,11 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles() qWarning() << "Couldn't create patches folder for" << m_instance->name(); return; } - if(!deleteFile.isEmpty() && QFile::exists(deleteFile)) + if(!renameFile.isEmpty() && QFile::exists(renameFile)) { - if(!QFile::remove(deleteFile)) + if(!QFile::rename(renameFile, renameFile + ".old")) { - qWarning() << "Couldn't remove" << deleteFile << "from" << m_instance->name(); + qWarning() << "Couldn't rename" << renameFile << "to" << renameFile + ".old" << "in" << m_instance->name(); return; } } @@ -68,9 +68,9 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles() qWarning() << "Couldn't save main patch in" << m_instance->name(); return; } - if(!QFile::remove(sourceFile)) + if(!QFile::rename(sourceFile, sourceFile + ".old")) { - qWarning() << "Couldn't remove" << sourceFile << "from" << m_instance->name(); + qWarning() << "Couldn't rename" << sourceFile << "to" << sourceFile + ".old" << "in" << m_instance->name(); return; } } -- cgit v1.2.3