MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / getChild

Method getChild

system/lib/wasmfs/file.cpp:54–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54std::shared_ptr<File> Directory::Handle::getChild(const std::string& name) {
55 // Unlinked directories must be empty, without even "." or ".."
56 if (!getParent()) {
57 return nullptr;
58 }
59 if (name == ".") {
60 return file;
61 }
62 if (name == "..") {
63 return getParent();
64 }
65 // Check whether the cache already contains this child.
66 auto& dcache = getDir()->dcache;
67 if (auto it = dcache.find(name); it != dcache.end()) {
68 return it->second.file;
69 }
70 // Otherwise check whether the backend contains an underlying file we don't
71 // know about.
72 auto child = getDir()->getChild(name);
73 if (!child) {
74 return nullptr;
75 }
76 cacheChild(name, child, DCacheKind::Normal);
77 return child;
78}
79
80bool Directory::Handle::mountChild(const std::string& name,
81 std::shared_ptr<File> child) {

Callers 9

_wasmfs_write_fileFunction · 0.45
doOpenFunction · 0.45
doMkdirFunction · 0.45
__syscall_unlinkatFunction · 0.45
wasmfs_unmountFunction · 0.45
__syscall_renameatFunction · 0.45
__syscall_symlinkatFunction · 0.45
preloadFilesMethod · 0.45
getChildFunction · 0.45

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected