This module implements file handling.
See also:
- paths module for path manipulation
Procs
proc fileExists(filename: Path): bool {.inline, ...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.
Source Edit proc moveFile(source, dest: Path) {.inline, ...tags: [ReadDirEffect, ReadIOEffect, WriteIOEffect], raises: [OSError], forbids: [].}
-
Moves a file from source to dest.
Symlinks are not followed: if source is a symlink, it is itself moved, not its target.
If this fails, OSError is raised. If dest already exists, it will be overwritten.
Can be used to rename files.
See also:
Source Edit proc removeFile(file: Path) {.inline, ...tags: [WriteDirEffect], raises: [OSError], forbids: [].}
-
Removes the file.
If this fails, OSError is raised. This does not fail if the file never existed in the first place.
On Windows, ignores the read-only attribute.
See also:
Source Edit