☰

# pathutils

Theme:

- Index

Search:
Group by:
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

    AnyPath = AbsoluteFile | AbsoluteDir | RelativeFile | RelativeDir

  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: [], forbids: [].}

  Source Edit

    proc `/`(base: AbsoluteDir; f: RelativeFile): AbsoluteFile {....raises: [OSError],
        tags: [], forbids: [].}

  Source Edit

    proc `==`[T: AnyPath](x, y: T): bool

  Source Edit

    proc addFileExt(x: AbsoluteFile; ext: string): AbsoluteFile {.borrow,
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc addFileExt(x: RelativeFile; ext: string): RelativeFile {.borrow,
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc changeFileExt(x: AbsoluteFile; ext: string): AbsoluteFile {.borrow,
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc changeFileExt(x: RelativeFile; ext: string): RelativeFile {.borrow,
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc cmpPaths(x, y: AbsoluteDir): int {.borrow, ...raises: [], tags: [],
                                            forbids: [].}

  Source Edit

    proc copyFile(source, dest: AbsoluteFile) {....raises: [OSError, IOError],
        tags: [ReadDirEffect, ReadIOEffect, WriteIOEffect], forbids: [].}

  Source Edit

    proc createDir(x: AbsoluteDir) {.borrow, ...raises: [OSError, IOError],
                                     tags: [WriteDirEffect, ReadDirEffect],
                                     forbids: [].}

  Source Edit

    proc customPath(x: string): string {....raises: [OSError], tags: [], forbids: [].}

  Source Edit

    proc dirExists(x: AbsoluteDir): bool {.borrow, ...raises: [],
                                           tags: [ReadDirEffect], forbids: [].}

  Source Edit

    proc extractFilename(x: AbsoluteFile): string {.borrow, ...raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc fileExists(x: AbsoluteFile): bool {.borrow, ...raises: [],
        tags: [ReadDirEffect], forbids: [].}

  Source Edit

    proc isEmpty(x: AnyPath): bool {.inline.}

  Source Edit

    proc quoteShell(x: AbsoluteDir): string {.borrow, ...raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc quoteShell(x: AbsoluteFile): string {.borrow, ...raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc relativeTo(fullPath: AbsoluteFile; baseFilename: AbsoluteDir; sep = DirSep): RelativeFile {.
        ...raises: [ValueError, OSError], tags: [RootEffect], forbids: [].}

  Source Edit

    proc removeFile(x: AbsoluteFile) {.borrow, ...raises: [OSError],
                                       tags: [WriteDirEffect], forbids: [].}

  Source Edit

    proc splitFile(x: AbsoluteFile): tuple[dir: AbsoluteDir, name, ext: string] {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc toAbsolute(file: string; base: AbsoluteDir): AbsoluteFile {.
        ...raises: [OSError], tags: [], forbids: [].}

  Source Edit

    proc toAbsoluteDir(path: string): AbsoluteDir {....raises: [OSError], tags: [],
        forbids: [].}

  Source Edit

    proc writeFile(x: AbsoluteFile; content: string) {.borrow, ...raises: [IOError],
        tags: [WriteIOEffect], forbids: [].}

  Source Edit