bool IsAbsolutePath(const TCHAR *p) { #ifdef WIN32 if (IsDrive(p) && IsDirSeparator(p[2])) return true; #endif return IsDirSeparator(*p); }
bool Path::IsAbsolute() const { assert(!IsNull()); #ifdef WIN32 if (IsDrive(c_str()) && IsDirSeparator(c_str()[2])) return true; #endif return IsDirSeparator(c_str()[0]); }
Path Path::RelativeTo(Path parent) const { assert(!IsNull()); assert(!parent.IsNull()); auto p = StringAfterPrefix(c_str(), parent.c_str()); return p != nullptr && IsDirSeparator(*p) ? Path(p + 1) : nullptr; }