☰

# std/private/oscommon

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

# Imports

oserrors, syncio, assertions, widestrs, staticos, posix

# Types

    ReadDirEffect = object of ReadIOEffect

  Effect that denotes a read operation from the directory structure. Source Edit

    WriteDirEffect = object of WriteIOEffect

  Effect that denotes a write operation to the directory structure. Source Edit

# Consts

    maxSymlinkLen = 1024

  Source Edit

    supportedSystem = true

  Source Edit

    weirdTarget = false

  Source Edit

# Procs

    proc dirExists(dir: string): bool {....gcsafe, extern: "nos$1",
                                        tags: [ReadDirEffect], sideEffect,
                                        ...raises: [], forbids: [].}

  Returns true if the directory `dir` exists. If `dir` is a file, false is returned. Follows symlinks.

  See also:

  - fileExists proc
  - symlinkExists proc
  Source Edit

    proc fileExists(filename: string): bool {....gcsafe, extern: "nos$1",
        tags: [ReadDirEffect], sideEffect, ...raises: [], forbids: [].}

  Returns true if `filename` exists and is a regular file or symlink.

  Directories, device files, named pipes and sockets return false.

  See also:

  - dirExists proc
  - symlinkExists proc
  Source Edit

    proc getSymlinkFileKind(path: string): tuple[pc: PathComponent, isSpecial: bool] {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc symlinkExists(link: string): bool {....gcsafe, extern: "nos$1",
        tags: [ReadDirEffect], sideEffect, ...raises: [], forbids: [].}

  Returns true if the symlink `link` exists. Will return true regardless of whether the link points to a directory or file.

  See also:

  - fileExists proc
  - dirExists proc
  Source Edit

    proc tryMoveFSObject(source, dest: string; isDir: bool): bool {.
        ...raises: [OSError], tags: [], forbids: [].}

  Moves a file (or directory if `isDir` is true) from `source` to `dest`.

  Returns false in case of `EXDEV` error or `AccessDeniedError` on Windows (if `isDir` is true). In case of other errors `OSError` is raised. Returns true in case of success.

  Source Edit