MCPcopy Create free account
hub / github.com/Samsung/UTopia / getNormalizedPath

Function getNormalizedPath

lib/utils/FileUtil.cpp:146–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146std::string getNormalizedPath(std::string Path) {
147
148 std::vector<fs::path> Tokens;
149
150 fs::path FSPath(Path);
151 for (auto S = FSPath.begin(), E = FSPath.end(); S != E; ++S) {
152 if (*S == ".")
153 continue;
154
155 if (*S == ".." && Tokens.size() > 0) {
156 Tokens.pop_back();
157 continue;
158 }
159
160 Tokens.push_back(*S);
161 }
162
163 fs::path Result;
164 for (auto &Token : Tokens)
165 Result /= Token;
166
167 return Result.string();
168}
169
170std::string getParentPath(std::string Path) {
171

Callers 9

setLocationMethod · 0.85
ASTNodeMethod · 0.85
LocIndexMethod · 0.85
SourceAnalyzerImplMethod · 0.85
addFuzzerMethod · 0.85
UnittestMethod · 0.85
fromJsonMethod · 0.85
getFullPathFunction · 0.85

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.80

Tested by 1

UnittestMethod · 0.68