Exemplo n.º 1
0
bool
IsAbsolutePath(const TCHAR *p)
{
#ifdef WIN32
    if (IsDrive(p) && IsDirSeparator(p[2]))
        return true;
#endif

    return IsDirSeparator(*p);

}
Exemplo n.º 2
0
bool
Path::IsAbsolute() const
{
  assert(!IsNull());

#ifdef WIN32
  if (IsDrive(c_str()) && IsDirSeparator(c_str()[2]))
    return true;
#endif

  return IsDirSeparator(c_str()[0]);
}
Exemplo n.º 3
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;
}