# std/private/oscommon

Theme:

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

Search:
Source Edit

# Imports

oserrors, staticos, winlean, times

# 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

    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 findFirstFile(a: string; b: var WIN32_FIND_DATA): Handle {....raises: [],
        tags: [], forbids: [].}

  Source Edit

    proc openHandle(path: string; followSymlink = true; writeAccess = false): Handle {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc skipFindData(f: WIN32_FIND_DATA): bool {.inline, ...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

# Templates

    template findNextFile(a, b: untyped): untyped

  Source Edit

    template getFilename(f: untyped): untyped

  Source Edit

    template wrapBinary(varname, winApiProc, arg, arg2: untyped)

  Source Edit

    template wrapUnary(varname, winApiProc, arg: untyped)

  Source Edit