class HackFilesystem
Defined at line 33 of file ../../src/ui/lib/escher/fs/hack_filesystem.h
An in-memory file system that could be watched for content change.
Protected Members
optional base_path_
Public Methods
HackFilesystemPtr New ()
Create a platform-appropriate HackFileSystem (e.g. for Fuchsia or Linux).
Defined at line 19 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
HackFilesystemPtr New (const std::shared_ptr<vfs::PseudoDir> & root_dir)
Defined at line 16 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
void ~HackFilesystem ()
Defined at line 37 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 39 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
void WriteFile (const HackFilePath & path, HackFileContents new_contents)
Set the file contents and notify watchers of the change.
Defined at line 47 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
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 71 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
bool InitializeWithRealFiles (const std::vector<HackFilePath> & paths, const char * root)
Load the specified files from the real filesystem, given a root directory.
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.
void InvalidateFile (const HackFilePath & path)
Notifies all watchers that their watched file has changed (it actually hasn't).
Defined at line 57 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
void InvalidateAllFiles ()
Calls |InvalidateFile()| for each file in the filesystem.
Defined at line 65 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 |InitializeWithRealFiles|
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 77 of file ../../src/ui/lib/escher/fs/hack_filesystem.h
Protected Methods
void HackFilesystem ()
Defined at line 80 of file ../../src/ui/lib/escher/fs/hack_filesystem.h
bool LoadFile (HackFilesystem * fs, const HackFilePath & root, const HackFilePath & path)
Defined at line 89 of file ../../src/ui/lib/escher/fs/hack_filesystem.cc
Friends
class HackFilesystemWatcher