MCPcopy Create free account
hub / github.com/Illation/ETEngine / GetAbsolutePath

Method GetAbsolutePath

Engine/source/EtCore/FileSystem/FileUtil.cpp:395–422  ·  view source on GitHub ↗

--------------------------------- FileUtil::GetAbsolutePath Gets the absolute path relative to the executable

Source from the content-addressed store, hash-verified

393// Gets the absolute path relative to the executable
394//
395std::string FileUtil::GetAbsolutePath(std::string const& path)
396{
397 // full path unedited
398 std::string combinedPath;
399
400 // if the path is already absolute we just trim without appending the exe dir
401 if (IsAbsolutePath(path))
402 {
403 combinedPath = path;
404 }
405 else
406 {
407 combinedPath = GetExecutableDir() + path;
408 }
409
410 // remove excess delimiters first so that removing parent directories is reliable
411 RemoveExcessPathDelimiters(combinedPath);
412
413 // remove .. and . tokens until there are none left
414 bool isRelative = true;
415 while (isRelative)
416 {
417 isRelative = RemoveRelativePath(combinedPath);
418 }
419
420 UnifyPathDelimiters(combinedPath);
421 return combinedPath;
422}
423
424//---------------------------------
425// FileUtil::GetRelativePath

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected