mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 13:31:49 +00:00
fixes
This commit is contained in:
parent
2a8fa4f2fa
commit
536035441a
5 changed files with 26 additions and 3 deletions
|
|
@ -59,10 +59,16 @@ io::file_time_type io::MemoryDevice::lastWriteTime(std::string_view path) {
|
|||
}
|
||||
|
||||
bool io::MemoryDevice::exists(std::string_view path) {
|
||||
if (path.empty()) {
|
||||
return true;
|
||||
}
|
||||
return nodes.find(std::string(path)) != nodes.end();
|
||||
}
|
||||
|
||||
bool io::MemoryDevice::isdir(std::string_view path) {
|
||||
if (path.empty()) {
|
||||
return true;
|
||||
}
|
||||
const auto& found = nodes.find(std::string(path));
|
||||
if (found == nodes.end()) {
|
||||
return false;
|
||||
|
|
@ -201,6 +207,9 @@ io::MemoryDevice::Node* io::MemoryDevice::createFile(
|
|||
}
|
||||
|
||||
io::MemoryDevice::Dir* io::MemoryDevice::getDir(std::string_view path) {
|
||||
if (path.empty()) {
|
||||
return &rootDir;
|
||||
}
|
||||
const auto& found = nodes.find(std::string(path));
|
||||
if (found == nodes.end()) {
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ namespace io {
|
|||
std::unique_ptr<PathsGenerator> list(std::string_view path) override;
|
||||
private:
|
||||
std::unordered_map<std::string, Node> nodes;
|
||||
Dir rootDir {};
|
||||
|
||||
Node* createFile(std::string path, util::Buffer<char>&& content);
|
||||
Dir* createDir(std::string path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue