MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / upMultipleLevels

Function upMultipleLevels

core/filetools.cpp:263–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261 }
262
263 std::string upMultipleLevels(const std::string &name, unsigned int nrOfLevels)
264 {
265 if (isRoot(name))
266 return name;
267
268 std::string s(name);
269 if (isOnlyDirectory(name))
270 s = stripTrailingSlash(s);
271
272 fs::path p(s);
273 if (nrOfLevels == 1)
274 return p.parent_path().string();
275 else
276 return upMultipleLevels(p.parent_path().string(), nrOfLevels - 1);
277 }
278
279//---------------------------------------------------------------------------
280 std::string extractFilePath(const std::string &name)

Callers

nothing calls this directly

Calls 3

isRootFunction · 0.85
isOnlyDirectoryFunction · 0.85
stripTrailingSlashFunction · 0.85

Tested by

no test coverage detected