File¶
The file will open, by default, /dev/shm/alephzero/path. The /dev/shm/alephzero comes from the A0_ROOT environment variable.
See below. You can also open that file with: If the file doesn’t exist, it will be created, along with any directories. If you want to set the size: Note create_options do not effect existing files. create_options can also be used to set mode. The A0_ROOT environment variable controls relative file paths.
It can be used to sandbox applications. A0_ROOT defaults to the directory /dev/shm/alephzero A0_ROOT must be an absolute path (start with ‘/’).
It is NOT relative to your current directory.
Tilde ‘~’ is not expanded.Create and Open¶
a0::File file("path");
a0::File file("/dev/shm/alephzero/path");
auto opts = a0::File::Options::DEFAULT;
opts.create_options.size = 4 * 1024;
a0::File file("path", opts);
Usage¶
a0::File file("path");
a0::Arena arena = file;
a0::Buf buf = file;
file.size();
file.path(); // absolute path
file.fd();
file.stat(); // at time of open
Removing¶
a0::File::remove("path");
a0::File::remove_all("dir"); // recursive
A0_ROOT¶