MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / DirNameFromString

Function DirNameFromString

launcher/FileSystem.cpp:334–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334QString DirNameFromString(QString string, QString inDir)
335{
336 int num = 0;
337 QString baseName = RemoveInvalidFilenameChars(string, '-');
338 QString dirName;
339 do {
340 if (num == 0) {
341 dirName = baseName;
342 } else {
343 dirName = baseName + "(" + QString::number(num) + ")";
344 }
345
346 // If it's over 9000
347 if (num > 9000)
348 return "";
349 num++;
350 } while (QFileInfo(PathCombine(inDir, dirName)).exists());
351 return dirName;
352}
353
354// Does the folder path contain any '!'? If yes, return true, otherwise false.
355// (This is a problem for Java)

Callers 3

commitStagedInstanceMethod · 0.85
installMethod · 0.85
renameMethod · 0.85

Calls 3

PathCombineFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected