private function relativePath()

in src/Writer.hack [273:283]


  private function relativePath(string $path): string {
    $root = $this->root;
    if ($root === null) {
      throw new Exception('Call setRoot() before writeToFile()');
    }
    $path = \realpath($path);
    if (Str\starts_with($path, $root)) {
      return Str\slice($path, Str\length($root) + 1);
    }
    throw new Exception("%s is outside root %s", $path, $root);
  }