Skip to content
FutureBlitz

    Install

    Import std.io.dir

    std.io.dir

    std.io's folders: making and removing them, what's in one, and in the folders in it, the paths in one that a glob pattern matches, and the current and temporary folders. Each call has an Async twin, which libuv's thread pool does while the main thread goes on.

    std/io/dir.fb

    Types

    DirEntry struct

    Public Struct DirEntry

    Something in a folder: where it is, where it is from the folder that was listed, which for Entries is its name, and what it is.

    std/io/dir.fb, line 30

    • Public ReadOnly Field Path: Path field #

      Where it is.

    • Public ReadOnly Field Relative: Path field #

      Where it is from the folder that was listed, which for Entries is its name.

    • Public ReadOnly Field Kind: FileKind field #

      Whether it's a file, a folder, or a link.

    • Public Method Name(): String method #

      Its own name, the last in its path.

    • Public Method IsFile(): Bool method #

      Whether it's a file.

    • Public Method IsDirectory(): Bool method #

      Whether it's a folder.

    Dir struct

    Public Struct Dir

    A folder's Static Methods.

    std/io/dir.fb, line 53

    • Public Static Method Create(path: Path) Throws IOError static method #

      Makes the folder, in one that's there. One that's there already throws an IOError of ALREADY_EXISTS.

    • Public Static Async Method CreateAsync(path: Path) Throws IOError static method #

      What Create does, without blocking its thread: a call gives its Task.

    • Public Static Method CreateAll(path: Path) Throws IOError static method #

      Makes the folder, and each folder it's in that isn't there yet. One that's there already is fine, and a file where a folder should be throws an IOError of NOT_A_DIRECTORY.

    • Public Static Async Method CreateAllAsync(path: Path) Throws IOError static method #

      What CreateAll does, without blocking its thread: a call gives its Task.

    • Public Static Method Remove(path: Path): Bool Throws IOError static method #

      Removes the folder, which has to be empty, and gives whether there was one. One with something in it throws an IOError of NOT_EMPTY, and a file one of NOT_A_DIRECTORY.

    • Public Static Async Method RemoveAsync(path: Path): Bool Throws IOError static method #

      What Remove does, without blocking its thread: a call gives its Task.

    • Public Static Method RemoveAll(path: Path): Bool Throws IOError static method #

      Removes the folder and everything in it, and gives whether there was one. A link in it is removed, not what it links to, and a file throws an IOError of NOT_A_DIRECTORY.

    • Public Static Async Method RemoveAllAsync(path: Path): Bool Throws IOError static method #

      What RemoveAll does, without blocking its thread: a call gives its Task.

    • Public Static Method Exists(path: Path): Bool static method #

      Whether there's a folder at the path, or a link to one. One the program can't look at isn't there, as far as it can tell.

    • Public Static Async Method ExistsAsync(path: Path): Bool static method #

      What Exists does, without blocking its thread: a call gives its Task.

    • Public Static Method Entries(path: Path): DirEntry[] Throws IOError static method #

      What's in the folder, in the order of their names' bytes, the same on every OS.

    • Public Static Async Method EntriesAsync(path: Path): DirEntry[] Throws IOError static method #

      What Entries does, without blocking its thread: a call gives its Task.

    • Public Static Method Walk(path: Path): DirEntry[] Throws IOError static method #

      What's in the folder and in each folder in it, all the way down, each folder before what's in it, and each folder's entries in the order of their names' bytes. It doesn't go into links, so a link to a folder above can't make it go round forever. A folder in it that can't be listed throws an IOError naming that folder.

    • Public Static Async Method WalkAsync(path: Path): DirEntry[] Throws IOError static method #

      What Walk does, without blocking its thread: a call gives its Task.

    • Public Static Method Glob(path: Path, pattern: String): DirEntry[] Throws IOError static method #

      What's in the folder, and in the folders in it, whose path from it matches pattern, in Walk's order. The pattern's names go between '/'s, and ''s too by Windows' rules, each matching one name in the path: '' matches any run of characters in a name, '?' any one character, and [abc], [a-z], and [!abc] one character of or not of those; a name that's just "**" matches any number of folders, none too, and last, everything below, files too, and the folder before it. So ".png" matches the folder's PNGs, and "**/*.png" every PNG in it. A '[' with no ']' after it is just itself, and a pattern with no names matches nothing. Names match exactly, in the same case, on every OS. Only the folders the pattern can reach into are listed.

    • Public Static Async Method GlobAsync(path: Path, pattern: String): DirEntry[] Throws IOError static method #

      What Glob does, without blocking its thread: a call gives its Task.

    • Public Static Method Current(): Path Throws IOError static method #

      The program's current folder, which relative paths are from.

    • Public Static Method SetCurrent(path: Path) Throws IOError static method #

      Makes the folder the program's current one, for every thread.

    • Public Static Method Temp(): Path Throws IOError static method #

      The OS's folder for temporary files, which TempFile and TempDir make theirs in.

    Report an issue with this page or with FutureBlitz on GitHub.