pathutils

Path handling utilities for Nim. Strictly typed code in order to avoid the never ending time sink in getting path handling right.

Types

AbsoluteFile = distinct string
  Source Edit
AbsoluteDir = distinct string
  Source Edit
RelativeFile = distinct string
  Source Edit
RelativeDir = distinct string
  Source Edit
AnyPath = AbsoluteFile | AbsoluteDir | RelativeFile | RelativeDir
  Source Edit

Procs

proc isEmpty(x: AnyPath): bool {...}{.inline.}
  Source Edit
proc copyFile(source, dest: AbsoluteFile) {...}{.raises: [OSError],
    tags: [ReadIOEffect, WriteIOEffect].}
  Source Edit
proc removeFile(x: AbsoluteFile) {...}{.borrow.}
  Source Edit
proc splitFile(x: AbsoluteFile): tuple[dir: AbsoluteDir, name, ext: string] {...}{.
    raises: [], tags: [].}
  Source Edit
proc extractFilename(x: AbsoluteFile): string {...}{.borrow.}
  Source Edit
proc fileExists(x: AbsoluteFile): bool {...}{.borrow.}
  Source Edit
proc dirExists(x: AbsoluteDir): bool {...}{.borrow.}
  Source Edit
proc quoteShell(x: AbsoluteFile): string {...}{.borrow.}
  Source Edit
proc quoteShell(x: AbsoluteDir): string {...}{.borrow.}
  Source Edit
proc cmpPaths(x, y: AbsoluteDir): int {...}{.borrow.}
  Source Edit
proc createDir(x: AbsoluteDir) {...}{.borrow.}
  Source Edit
proc toAbsoluteDir(path: string): AbsoluteDir {...}{.raises: [OSError], tags: [].}
  Source Edit
proc `$`(x: AnyPath): string
  Source Edit
proc `==`[T: AnyPath](x, y: T): bool
  Source Edit
proc `/`(base: AbsoluteDir; f: RelativeFile): AbsoluteFile {...}{.raises: [OSError],
    tags: [].}
  Source Edit
proc `/`(base: AbsoluteDir; f: RelativeDir): AbsoluteDir {...}{.raises: [OSError],
    tags: [].}
  Source Edit
proc relativeTo(fullPath: AbsoluteFile; baseFilename: AbsoluteDir; sep = DirSep): RelativeFile {...}{.
    raises: [Exception], tags: [RootEffect].}
  Source Edit
proc toAbsolute(file: string; base: AbsoluteDir): AbsoluteFile {...}{.
    raises: [OSError], tags: [].}
  Source Edit
proc changeFileExt(x: AbsoluteFile; ext: string): AbsoluteFile {...}{.borrow.}
  Source Edit
proc changeFileExt(x: RelativeFile; ext: string): RelativeFile {...}{.borrow.}
  Source Edit
proc addFileExt(x: AbsoluteFile; ext: string): AbsoluteFile {...}{.borrow.}
  Source Edit
proc addFileExt(x: RelativeFile; ext: string): RelativeFile {...}{.borrow.}
  Source Edit
proc writeFile(x: AbsoluteFile; content: string) {...}{.borrow.}
  Source Edit