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

Function DirNameFromString

launcher/FileSystem.cpp:863–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

861}
862
863QString DirNameFromString(QString string, QString inDir)
864{
865 int num = 0;
866 QString baseName = RemoveInvalidFilenameChars(string, '-');
867 QString dirName;
868 do {
869 if (num == 0) {
870 dirName = baseName;
871 } else {
872 dirName = baseName + "(" + QString::number(num) + ")";
873 }
874
875 // If it's over 9000
876 if (num > 9000)
877 return "";
878 num++;
879 } while (QFileInfo(PathCombine(inDir, dirName)).exists());
880 return dirName;
881}
882
883// Does the folder path contain any '!'? If yes, return true, otherwise false.
884// (This is a problem for Java)

Callers 4

commitStagedInstanceMethod · 0.85
installMethod · 0.85
renameMethod · 0.85

Calls 4

QFileInfoClass · 0.85
PathCombineFunction · 0.85
existsMethod · 0.45

Tested by

no test coverage detected