Files
Ext2FS/fs/vfs.cpp
T
2019-06-21 22:51:24 +08:00

20 lines
416 B
C++

#include "vfs.h"
#include <string>
using namespace VFS;
DEntry *DEntry::get_child(const std::string& name) {
load_children();
for (auto x: children) {
if (x->name == name)
return x;
}
return nullptr;
}
File *DEntry::open(const std::string& name) {
auto a = get_child(name);
if (a == nullptr || a->type != RegularFile)
return nullptr;
return a->get_file();
}