class HackFilesystem

Defined at line 33 of file ../../src/ui/lib/escher/fs/hack_filesystem.h

An in-memory file system that can be watched for content change.

Public Methods

HackFilesystemPtr New (const char * root)

Instantiate a filesystem.

Files will be loaded from the real filesystem, using the specified root directory

path. On Fuchsia the default root is "/pkg/data/"; on Linux, the default is

"../test_data/escher", which points to a directory of escher test data relative

to the test binary itself.

If no files are needed, passing nullptr is OK. Examples:

- a test will be using `WriteFileForTest()`, so doesn't need access to the real filesystem

- an application uses Escher with no shaders; e.g. when only `DebugFont` is used.

Defined at line 24 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc

HackFilesystemPtr New (fidl::ClientEnd<fuchsia_io::Directory> dir)

Instantiate a filesystem. Files will be loaded from the provided directory.

Defined at line 31 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc

void ~HackFilesystem ()

Defined at line 38 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc

HackFileContents ReadFile (const HackFilePath & path)

Return the contents of the file, which can be empty if the path doesn't

exist (HackFilesystem doesn't distinguish between empty and non-existent

files).

Defined at line 40 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc

const std::optional<std::string> & base_path ()

If the hack file system was initialized with a call to |InitializeWithBasePath|

then the member variable base_path_ is set to be the absolute path of the

root path that was provided. If the file system was not initialized, then the

optional return value will be null.

Defined at line 73 of file ../../src/ui/lib/escher/fs/hack_filesystem.h

const std::optional<fidl::SyncClient<fuchsia_io::Directory>> & base_dir ()

Defined at line 76 of file ../../src/ui/lib/escher/fs/hack_filesystem.h

void WriteFileForTest (const HackFilePath & path, HackFileContents new_contents)

Set the file contents and notify watchers of the change.

Defined at line 82 of file ../../src/ui/lib/escher/fs/hack_filesystem.h

std::unique_ptr<HackFilesystemWatcher> RegisterWatcher (HackFilesystemWatcherFunc func)

The watcher will be notified whenever any of the paths that it cares

about change. To stop watching, simply release the unique_ptr.

Defined at line 86 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc

Friends

class RefCountedThreadSafe
class HackFilesystemWatcher
class MakeRefCountedHelper