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

Function cleanPath

source/io/fs.cpp:148–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148bool cleanPath(std::vector<BString>& parts) {
149 for (U32 i=0;i<parts.size();) {
150 if (parts[i].length()==0) { // ignore double slashes
151 parts.erase(parts.begin()+i, parts.begin()+i+1);
152 continue;
153 }
154 if (parts[i]==".") {
155 i++;
156 continue;
157 }
158 if (parts[i]=="..") {
159 if (i==0)
160 return false;
161 parts.erase(parts.begin()+i-1, parts.begin()+i+1);
162 i--;
163 continue;
164 }
165 i++;
166 }
167 return true;
168}
169
170std::shared_ptr<FsNode> Fs::getNodeFromLocalPath(const BString& currentDirectory, const BString& path, std::shared_ptr<FsNode>* lastNode, std::vector<BString>* missingParts, bool followLink, bool* isLink) {
171 BString fullpath = Fs::getFullPath(currentDirectory, path);

Callers 1

getNodeFromLocalPathMethod · 0.85

Calls 4

sizeMethod · 0.45
lengthMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected