197 static const char *supportedFiles[] = {
198 ".C",
".cpp",
".h",
".css",
".xml",
".png",
".gif",
".csv",
".ico", 0
203 parent->appendRow(dir);
206 std::set<fs::path> paths;
208 fs::directory_iterator end_itr;
209 for (fs::directory_iterator i(path); i != end_itr; ++i)
212 std::vector<FileItem*> classes, files;
213 std::vector<fs::path> dirs;
215 while (!paths.empty()) {
216 fs::path p = *paths.begin();
220 if (fs::is_symlink(p))
224 if (fs::is_regular(p)) {
225 std::string ext = fs::extension(p);
226 bool supported =
false;
227 for (
const char **s = supportedFiles; *s != 0; ++s)
239 if (!companion.empty()) {
240 std::set<fs::path>::iterator it_companion = paths.find(companion);
242 if (it_companion != paths.end()) {
243 std::string className =
stem(p);
244 escapeText(className);
245 std::string label =
"<i>class</i> " + className;
248 new FileItem(
"/icons/cppclass.png", label, std::string());
249 classItem->setFlags(classItem->flags() | ItemIsXHTMLText);
255 (*it_companion).string());
256 classItem->appendRow(header);
257 classItem->appendRow(cpp);
259 classes.push_back(classItem);
260 paths.erase(it_companion);
264 files.push_back(file);
266 }
else if (fs::is_directory(p)) {
271 files.push_back(file);
277 for (
unsigned int i = 0; i < classes.size(); i++)
278 parent->appendRow(classes[i]);
280 for (
unsigned int i = 0; i < files.size(); i++)
281 parent->appendRow(files[i]);
283 for (
unsigned int i = 0; i < dirs.size(); i++)
285 }
catch (fs::filesystem_error& e) {
286 std::cerr << e.what() << std::endl;
static std::string stem(const fs::path &p)
WStandardItem which stores a file.
void cppTraverseDir(Wt::WStandardItem *parent, const boost::filesystem::path &path)
static std::string filename(const fs::path &p)
static bool comparePaths(const fs::path &p1, const fs::path &p2)
static fs::path getCompanion(const fs::path &path)