LEVIATHAN v962456e · 962456eee1

Standard Library

class SystemFileSystem

The real file system behind the IFileSystem interface.

since 0.1.0-alpha.1linuxwindows

bases
IFileSystem

Examples

IFileSystem fs = SystemFileSystem();
console.writeln(fs.exists("/definitely/not/here.txt"));
false

Methods

exists

exists(string path) -> bool

Check whether a real path exists.

Parameters

path
The path to look up.

Returns

true when something exists at the path.

Examples

SystemFileSystem fs = SystemFileSystem();
console.writeln(fs.exists("/definitely/not/here.txt"));
false

open

open(string path, OpenMode mode) -> File

Open a real file.

Parameters

path
The path of the file.
mode
How to open it, such as std::read or std::write.

Returns

The opened file.

Throws

FileException
when the file cannot be opened.

Examples

SystemFileSystem fs = SystemFileSystem();
try {
    fs.open("/definitely/not/here.txt", std::read);
} catch (FileException e) {
    console.writeln("open failed");
}
open failed

See also

  • IFileSystem — What a program may do with the file system: open files and check whether a path exists.
  • File — An open file.