Import std.io.vfs
std.io.vfs
std.io's virtual file system: a Vfs mounts folders, embedded folders, zips, and a program's own sources at points in one tree of its own, and reads them through the same calls as files. Its paths are its own, with '/' between names, on every OS; a later mount over the same place comes first, so a mod's folder can stand in for some of a game's embedded files.
std/io/vfs.fb
Types
VfsSource
interface
Public Interface VfsSource
Where a Vfs's files come from. Its paths are inside it, with '/' between names, and "" for its root, which is always a folder. What can't be read is an IOError; what isn't there is Null.
-
The bytes of the file at
path, or Null when there's no file there. -
What's at
path, or Null when nothing is. -
The names of what's in the folder at
path, and their kinds, in any order, or Null when there's no folder there.
FolderSource
class
Public Final Class FolderSource Implements VfsSource
A folder on the disk as a source, which reads it as it's asked, so it sees what changes in it. Nothing outside the folder is in it: by Windows' rules, a name with a ':' in it, which would be a drive or a file's stream, isn't there. Its root is a folder, empty while the folder isn't there or is a file. It's Final, so a Vfs's Async reads of it read what its Read does; a source that changes what a folder's files read as wraps one.
-
The folder on the disk it reads.
-
A FolderSource of
folder. -
The bytes of the file at
path, or Null when there's no file there.Doc from
std.io.vfs.VfsSource.Read. -
What's at
path, or Null when nothing is.Doc from
std.io.vfs.VfsSource.KindAt. -
The names of what's in the folder at
path, and their kinds, in any order, or Null when there's no folder there.Doc from
std.io.vfs.VfsSource.List.
EmbeddedSource
class
Public Class EmbeddedSource Implements VfsSource
Files a program has in memory as a source, by their paths, like what EmbedFolder gives: each key is a file's path, with '/' (or '') between folders, and the folders are the ones the paths go through. It keeps the arrays it's given, and a read gives a copy of a file's bytes.
-
Panics for a path that isn't a file's, one that goes above the root or has no names once its "."s and ".."s are taken out, like "", ".", or "a/..", and for paths that make one place a file and a folder too.
-
The bytes of the file at
path, or Null when there's no file there.Doc from
std.io.vfs.VfsSource.Read. -
What's at
path, or Null when nothing is.Doc from
std.io.vfs.VfsSource.KindAt. -
The names of what's in the folder at
path, and their kinds, in any order, or Null when there's no folder there.Doc from
std.io.vfs.VfsSource.List.
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.
-
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.