--------------------------------- FileUtil::GetAbsolutePath Gets the absolute path relative to the executable
| 393 | // Gets the absolute path relative to the executable |
| 394 | // |
| 395 | std::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 |
nothing calls this directly
no outgoing calls
no test coverage detected