Add upper-bound for randomisation

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2024-02-24 18:41:01 +00:00
parent df60f5cc96
commit bd0cd82826
No known key found for this signature in database
GPG Key ID: 5E39D70B4C93C38E

View File

@ -938,11 +938,15 @@ Task* InstanceList::wrapInstanceTask(InstanceTask* task)
QString InstanceList::getStagedInstancePath()
{
const QString tempRoot = FS::PathCombine(m_instDir, ".LAUNCHER_TEMP");
const QString tempRoot = FS::PathCombine(m_instDir, ".tmp");
QString result;
int tries = 0;
do {
if (++tries > 256)
return {};
const QString key = QUuid::createUuid().toString(QUuid::Id128).left(6);
result = FS::PathCombine(tempRoot, key);
} while (QFileInfo::exists(result));