Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Path

On POSIX: ┌──────────────────────┬────────────┐ │ dir │ base │ ├──────┬ ├──────┬─────┤ │ root │ │ name │ ext │ " / home/user/dir / file .txt " └──────┴───────────────┴──────┴─────┘

On Windows: ┌──────────────────────┬────────────┐ │ dir │ base │ ├──────┬ ├──────┬─────┤ │ root │ │ name │ ext │ " /c: / home/user/dir / file .txt " └──────┴───────────────┴──────┴─────┘

Hierarchy

  • Path

Index

Constructors

constructor

  • new Path(raw: string): Path

Properties

Private _dir

_dir: Path

Readonly base

base: string

Readonly ext

ext: string

Readonly isAbsolute

isAbsolute: boolean

Readonly isRoot

isRoot: boolean

Readonly name

name: string

Private Readonly raw

raw: string

Readonly root

root: Path | undefined

Static separator

separator: "/" = "/"

Accessors

dir

hasDir

  • get hasDir(): boolean
  • Returns true if this has a parent directory, false otherwise.

    This implementation returns true if and only if this is not the root dir and there is a path separator in the raw path.

    Returns boolean

Methods

Protected computeDir

  • computeDir(): Path

Protected computeRoot

  • computeRoot(): Path | undefined

isEqualOrParent

  • isEqualOrParent(path: Path): boolean

join

  • join(...paths: string[]): Path

normalize

relative

  • relative(path: Path): Path | undefined

relativity

  • relativity(path: Path): number

toString

  • toString(): string

Static isDrive

  • isDrive(segment: string): boolean

Static normalizeDrive

  • normalizeDrive(path: string): string

Static tildify

  • tildify(resourcePath: string, home: string): string
  • Tildify path, replacing home with ~ if user's home is present at the beginning of the path. This is a non-operation for Windows.

    Parameters

    • resourcePath: string
    • home: string

    Returns string