compiler/pathutils

  Source   Edit

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

Types

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

Procs

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