MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / loadChildren

Method loadChildren

source/io/fsnode.cpp:60–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void FsNode::loadChildren() {
61 if (!this->hasLoadedChildrenFromFileSystem) {
62 BOXEDWINE_CRITICAL_SECTION;
63 if (this->hasLoadedChildrenFromFileSystem) {
64 return;
65 }
66 this->hasLoadedChildrenFromFileSystem = true;
67 if (this->nativePath.length()) {
68 std::vector<Platform::ListNodeResult> results;
69 Platform::listNodes(nativePath, results);
70 for (auto& n : results) {
71 BString localPath = this->path;
72 BString remotePath = this->nativePath.stringByApppendingPath(n.name);
73 if (!localPath.endsWith("/")) {
74 localPath += "/";
75 }
76 Fs::remoteNameToLocal(n.name);
77 localPath+=n.name;
78 if (localPath.endsWith(EXT_MIXED)) {
79 localPath.remove(localPath.length() - 6);
80 }
81 if (localPath.endsWith(EXT_DOSATTRIB)) {
82 continue;
83 }
84 if (!localPath.endsWith(EXT_LINK)) {
85 Fs::addFileNode(localPath, B(""), remotePath, n.isDirectory, shared_from_this());
86 } else {
87 U8 tmp[MAX_FILEPATH_LEN];
88 U32 result = Fs::readNativeFile(remotePath, tmp, MAX_FILEPATH_LEN-1);
89 tmp[result]=0;
90 if (result==0) {
91 kwarn_fmt("Could not read link file from filesystem: %s", localPath.c_str());
92 }
93 localPath = localPath.substr(0, localPath.length()-5);
94 Fs::addFileNode(localPath, BString::copy((const char*)tmp), remotePath, n.isDirectory, shared_from_this());
95 }
96 }
97 }
98 }
99}
100
101
102std::shared_ptr<FsNode> FsNode::getChildByName(BString name) {

Callers 6

getChildByNameMethod · 0.95
getChildCountMethod · 0.95
addChildMethod · 0.95
removeChildByNameMethod · 0.95
getAllChildrenMethod · 0.95

Calls 8

BFunction · 0.85
kwarn_fmtFunction · 0.85
endsWithMethod · 0.80
substrMethod · 0.80
lengthMethod · 0.45
removeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected