MCPcopy Create free account
hub / github.com/MultiMC/Launcher / DirNameFromString

Function DirNameFromString

launcher/FileSystem.cpp:316–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316QString DirNameFromString(QString string, QString inDir)
317{
318 int num = 0;
319 QString baseName = RemoveInvalidFilenameChars(string, '-');
320 QString dirName;
321 do
322 {
323 if(num == 0)
324 {
325 dirName = baseName;
326 }
327 else
328 {
329 dirName = baseName + QString::number(num);;
330 }
331
332 // If it's over 9000
333 if (num > 9000)
334 return "";
335 num++;
336 } while (QFileInfo(PathCombine(inDir, dirName)).exists());
337 return dirName;
338}
339
340// Does the folder path contain any '!'? If yes, return true, otherwise false.
341// (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