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

Function NormalizePath

launcher/FileSystem.cpp:284–300  ·  view source on GitHub ↗

* Normalize path * * Any paths inside the current folder will be normalized to relative paths (to current) * Other paths will be made absolute */

Source from the content-addressed store, hash-verified

282 * Other paths will be made absolute
283 */
284QString NormalizePath(QString path)
285{
286 QDir a = QDir::currentPath();
287 QString currentAbsolute = a.absolutePath();
288
289 QDir b(path);
290 QString newAbsolute = b.absolutePath();
291
292 if (newAbsolute.startsWith(currentAbsolute))
293 {
294 return a.relativeFilePath(newAbsolute);
295 }
296 else
297 {
298 return newAbsolute;
299 }
300}
301
302QString badFilenameChars = "\"\\/?<>:;*|!+\r\n";
303

Calls

no outgoing calls

Tested by

no test coverage detected