void printWhole() { { // print this entry console.ui(" "); if (parent) { parent->printTrail(); console.ui("%s\n", filename(file).c_str()); } else { console.ui("%s\n", file.c_str()); } } { // print contents if (fileman.isDirectory(file)) { vector<string> children; { // fill vector typedef directory_iterator DirIt; for (DirIt i(file); i != DirIt(); i++) children.push_back(i->path().string()); } sort(children.begin(), children.end()); for (unsigned i = 0; i < children.size(); i++) { trail = THREE; if (i == children.size() - 1) trail = BENT; string childName = children[i]; fileman.markDirectory(childName); Branch(fileman, console, childName, this).printWhole(); } } } }
void printTrail() { if (parent) parent->printTrail(); switch (trail) { case THREE: console.ui("├── "); trail = VERTICAL; break; case VERTICAL: console.ui("│ "); break; case BENT: console.ui("└── "); trail = NONE; break; case NONE: console.ui(" "); break; } }