std/private/oscommon
Source Edit
Imports
oserrors, winlean, times
Types
-
PathComponent = enum
pcFile, ## path refers to a file
pcLinkToFile, ## path refers to a symbolic link to a file
pcDir, ## path refers to a directory
pcLinkToDir ## path refers to a symbolic link to a directory
-
Enumeration specifying a path component.
See also:
Source Edit
-
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
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:
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:
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:
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