VFS: add an exists() function
This commit is contained in:
parent
0a46feb162
commit
18fbccafb7
@ -42,6 +42,8 @@ namespace VFS
|
|||||||
|
|
||||||
Node* resolve_path(const char* filename, Node* root = nullptr);
|
Node* resolve_path(const char* filename, Node* root = nullptr);
|
||||||
|
|
||||||
|
bool exists(const char* pathname);
|
||||||
|
|
||||||
void mount(Node* mountpoint, Node* mounted);
|
void mount(Node* mountpoint, Node* mounted);
|
||||||
void mount(const char* pathname, Node* mounted);
|
void mount(const char* pathname, Node* mounted);
|
||||||
|
|
||||||
|
@ -160,6 +160,11 @@ int VFS::mkdir(const char* pathname)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VFS::exists(const char* pathname)
|
||||||
|
{
|
||||||
|
return resolve_path(pathname) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void VFS::mount(Node* mountpoint, Node* mounted)
|
void VFS::mount(Node* mountpoint, Node* mounted)
|
||||||
{
|
{
|
||||||
if (!mountpoint || !mounted) return;
|
if (!mountpoint || !mounted) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user