Import std.io.vfs
Vfs
class
Public Class Vfs
A tree of mounted sources, read as files are. A file is the one of the last mount that has it; a folder lists what each mount has in it, and the mounts under it.
Examples
Local files = Vfs()
Local embedded = {"config.txt": "size = 3".Bytes, "levels/one.txt": "first".Bytes}
files.MountEmbedded(Path("data"), embedded)
Expect((Try files.ReadText(Path("data/config.txt"))) == "size = 3")
Expect(files.DirExists(Path("data/levels")))
Expect(!files.Exists(Path("data/missing.txt")))-
A new Vfs, with nothing mounted.
-
Puts the
sourceatat, a path in the Vfs, "" or "/" for its root, before what's mounted already. Panics for a path that goes above the root. -
Mounts a folder on the disk at
at. -
Mounts
filesin memory, like what EmbedFolder gives, atat. -
Takes out the last mount at
at, and gives whether there was one. -
The bytes of the file at
path. One that no mount has throws an IOError of NOT_FOUND, a folder one of IS_A_DIRECTORY, and a path above the root one of INVALID_PATH. -
ReadBytes's Async twin, which reads a folder's files without blocking the main thread. It reads the mounts there were when it began, whatever's mounted while it waits.
-
The file's bytes as text, with U+FFFD for each one that doesn't start well-formed UTF-8.
-
What ReadText does, without blocking its thread: a call gives its Task.
-
The file's text in lines, split at "\n" and "\r\n", as File.ReadLines splits them.
-
What ReadLines does, without blocking its thread: a call gives its Task.
-
What's at
path: a file or a folder some mount has, or a folder a mount is in or at, or Null. What two mounts have is the last one's, as Entries finds it. -
Whether there's a file at
path, as KindOf finds it; an error is False. -
Whether there's a folder at
path, as KindOf finds it; an error is False. -
What's in the Vfs's root.
-
What's in the folder at
path, from every mount that has it, and the mounts in it, in the order of their names' bytes. A name two mounts have is the last one's. A folder no mount has throws an IOError of NOT_FOUND, a file one of NOT_A_DIRECTORY, and a path above the root one of INVALID_PATH. -
What's in the Vfs, all the way down, each folder before what's in it.
-
What's in the folder at
pathand 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 throws as Entries does. -
What's in the folder at
path, and in the folders in it, whose path from it matchespattern, as Dir.Glob's patterns match, with '/' or '' between its names on every OS, as between a Vfs path's. It throws as Entries does.
Report an issue with this page or with FutureBlitz on GitHub.