Path: Add RealPath()

This commit is contained in:
Stenzek
2023-12-05 15:21:37 +10:00
parent b166ec3403
commit 524625269f
3 changed files with 192 additions and 20 deletions

View File

@ -31,6 +31,9 @@ void SanitizeFileName(std::string* str, bool strip_slashes = true);
/// Returns true if the specified path is an absolute path (C:\Path on Windows or /path on Unix).
bool IsAbsolute(const std::string_view& path);
/// Resolves any symbolic links in the specified path.
std::string RealPath(const std::string_view& path);
/// Makes the specified path relative to another (e.g. /a/b/c, /a/b -> ../c).
/// Both paths must be relative, otherwise this function will just return the input path.
std::string MakeRelative(const std::string_view& path, const std::string_view& relative_to);