Add upper-bound for randomisation
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
df60f5cc96
commit
bd0cd82826
@ -938,11 +938,15 @@ Task* InstanceList::wrapInstanceTask(InstanceTask* task)
|
|||||||
|
|
||||||
QString InstanceList::getStagedInstancePath()
|
QString InstanceList::getStagedInstancePath()
|
||||||
{
|
{
|
||||||
const QString tempRoot = FS::PathCombine(m_instDir, ".LAUNCHER_TEMP");
|
const QString tempRoot = FS::PathCombine(m_instDir, ".tmp");
|
||||||
|
|
||||||
QString result;
|
QString result;
|
||||||
|
int tries = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
if (++tries > 256)
|
||||||
|
return {};
|
||||||
|
|
||||||
const QString key = QUuid::createUuid().toString(QUuid::Id128).left(6);
|
const QString key = QUuid::createUuid().toString(QUuid::Id128).left(6);
|
||||||
result = FS::PathCombine(tempRoot, key);
|
result = FS::PathCombine(tempRoot, key);
|
||||||
} while (QFileInfo::exists(result));
|
} while (QFileInfo::exists(result));
|
||||||
|
Loading…
Reference in New Issue
Block a user