GH-952 do not remove {version,custom}.json files, rename them
This commit is contained in:
parent
416e08f741
commit
f2026df597
@ -22,13 +22,13 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles()
|
|||||||
auto mcJson = PathCombine(m_instance->instanceRoot(), "patches" , "net.minecraft.json");
|
auto mcJson = PathCombine(m_instance->instanceRoot(), "patches" , "net.minecraft.json");
|
||||||
|
|
||||||
QString sourceFile;
|
QString sourceFile;
|
||||||
QString deleteFile;
|
QString renameFile;
|
||||||
|
|
||||||
// convert old crap.
|
// convert old crap.
|
||||||
if(QFile::exists(customJsonPath))
|
if(QFile::exists(customJsonPath))
|
||||||
{
|
{
|
||||||
sourceFile = customJsonPath;
|
sourceFile = customJsonPath;
|
||||||
deleteFile = versionJsonPath;
|
renameFile = versionJsonPath;
|
||||||
}
|
}
|
||||||
else if(QFile::exists(versionJsonPath))
|
else if(QFile::exists(versionJsonPath))
|
||||||
{
|
{
|
||||||
@ -41,11 +41,11 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles()
|
|||||||
qWarning() << "Couldn't create patches folder for" << m_instance->name();
|
qWarning() << "Couldn't create patches folder for" << m_instance->name();
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,9 +68,9 @@ void OneSixProfileStrategy::upgradeDeprecatedFiles()
|
|||||||
qWarning() << "Couldn't save main patch in" << m_instance->name();
|
qWarning() << "Couldn't save main patch in" << m_instance->name();
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user