| 146 | } |
| 147 | |
| 148 | bool 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 | |
| 170 | std::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); |
no test coverage detected