fs.mitm: Implement path normalization

This commit is contained in:
Michael Scire
2019-03-22 11:52:03 -07:00
parent b62014554c
commit c1588d0300
2 changed files with 104 additions and 3 deletions

View File

@@ -33,6 +33,14 @@ class FsPathUtils {
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
}
static bool IsCurrentDirectory(const char *path) {
return path[0] == '.' && (path[1] == 0 || path[1] == '/');
}
static bool IsParentDirectory(const char *path) {
return path[0] == '.' && path[1] == '.' && (path[2] == 0 || path[2] == '/');
}
static bool IsWindowsAbsolutePath(const char *path) {
/* Nintendo uses this in path comparisons... */
return IsWindowsDriveLetter(path[0]) && path[1] == ':';