VFS: add an exists() function

This commit is contained in:
apio 2022-10-16 16:58:18 +02:00
parent 0a46feb162
commit 18fbccafb7
2 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,8 @@ namespace VFS
Node* resolve_path(const char* filename, Node* root = nullptr);
bool exists(const char* pathname);
void mount(Node* mountpoint, Node* mounted);
void mount(const char* pathname, Node* mounted);

View File

@ -160,6 +160,11 @@ int VFS::mkdir(const char* pathname)
return result;
}
bool VFS::exists(const char* pathname)
{
return resolve_path(pathname) != nullptr;
}
void VFS::mount(Node* mountpoint, Node* mounted)
{
if (!mountpoint || !mounted) return;