MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / nearestExistentAncestor

Function nearestExistentAncestor

launcher/FileSystem.cpp:1202–1215  ·  view source on GitHub ↗

* @brief path to the near ancestor that exists * */

Source from the content-addressed store, hash-verified

1200 *
1201 */
1202QString nearestExistentAncestor(const QString& path)
1203{
1204 if (QFileInfo::exists(path))
1205 return path;
1206
1207 QDir dir(path);
1208 if (!dir.makeAbsolute())
1209 return {};
1210 do {
1211 dir.setPath(QDir::cleanPath(dir.filePath(QStringLiteral(".."))));
1212 } while (!dir.exists() && !dir.isRoot());
1213
1214 return dir.exists() ? dir.path() : QString();
1215}
1216
1217/**
1218 * @brief colect information about the filesystem under a file

Callers 1

statFSFunction · 0.85

Calls 5

QStringClass · 0.85
filePathMethod · 0.80
existsMethod · 0.80
setPathMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected