MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / directoryAt

Method directoryAt

lib/vfs/smaky6fs.cc:239–251  ·  view source on GitHub ↗

Returns the Directory whose entries are named by path. * path=[] → root; path=["DIR.DR"] → DR sub-directory. * The Smaky 6 FS is at most two levels deep; deeper paths are invalid. */

Source from the content-addressed store, hash-verified

237 * path=[] → root; path=["DIR.DR"] → DR sub-directory.
238 * The Smaky 6 FS is at most two levels deep; deeper paths are invalid. */
239 Directory directoryAt(const Path& path)
240 {
241 if (path.empty())
242 return Directory(this);
243 if (path.size() == 1)
244 {
245 auto parent = Directory(this).findFile(path[0]);
246 if (parent->file_type != TYPE_DIRECTORY)
247 throw BadPathException(path);
248 return Directory(this, parent->startSector);
249 }
250 throw BadPathException(path);
251 }
252
253 /* Resolves a full path to its SmakyDirent.
254 * path=["FILE"] → file in root; path=["DIR.DR","FILE"] → file in sub-dir. */

Callers

nothing calls this directly

Calls 5

BadPathExceptionClass · 0.85
DirectoryClass · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
findFileMethod · 0.45

Tested by

no test coverage detected