void testCHMkdir() { FileSystem fs; int depth = fs.pwdir().size(); FSPath fsp; fsp.push_back("delta"); fsp.push_back("echo"); fsp.push_back("foxtrot"); fs.chmkdir(fsp); myAssert(fs.pwdir().size(), (size_t)(depth + 3)); fs.up(); myAssert(fs.pwdir().size(), (size_t)(depth + 2)); fs.rmdir("foxtrot"); fs.up(); fs.rmdir("echo"); fs.up(); fs.rmdir("delta"); fs.up(); fs.up(); fs.up(); myAssert(fs.pwdir().size(), (size_t)depth); }
FSPath FileSystem::pwdir() { FSPath pwd; char path[255] = {0}; getcwd(path, sizeof(path)); for (char *token = strtok(path, "/"); token != NULL; ) { pwd.push_back(token); token = strtok(NULL, "/"); } return pwd; }