pub struct Folder { /* private fields */ }Expand description
The folder edited: the files under it of the extensions the explorer
shows — programs, and the data files operations read (see
OperationInfo::reads).
Implementations§
Source§impl Folder
impl Folder
pub fn new(root: &Path, extensions: Vec<String>) -> GeopResult<Self>
Sourcepub fn names_file(&self, path: &str) -> bool
pub fn names_file(&self, path: &str) -> bool
Whether path — relative, /-separated — can name a file of the
folder: no empty, . or .. segment, nothing a platform reads as
a root, a drive or a stream (/, \, :), and an extension shown.
Sourcepub fn file(&self, path: &str) -> GeopResult<PathBuf>
pub fn file(&self, path: &str) -> GeopResult<PathBuf>
The file path names under the folder — checked, before it is read
or written, to stay in it: where it is already, its own canonical
path; where it is not yet, that of the nearest folder above it
that is. A link out of the folder is refused like ...
Sourcepub fn files(&self) -> GeopResult<BTreeMap<String, String>>
pub fn files(&self) -> GeopResult<BTreeMap<String, String>>
Every file of the folder, by path, its content as a workspace holds
it: its text, or a data: URL of bytes that are not (see
geop_core_program::workspace::content). Hidden folders, node_modules and
target are left out, and so is a link out of the folder.
Sourcepub fn write(&self, path: &str, content: &str) -> GeopResult<()>
pub fn write(&self, path: &str, content: &str) -> GeopResult<()>
Write the file path, its content content as a workspace holds
it (see Folder::files): its bytes, the decoded ones of a data:
URL. Written whole, then put in place: a reader meanwhile sees the
old file or the new, never half of one.
Sourcepub fn remove(&self, path: &str) -> GeopResult<()>
pub fn remove(&self, path: &str) -> GeopResult<()>
Remove the file path; one already gone is no error.