199{
201 ".C", ".cpp", ".h", ".css", ".xml", ".png", ".gif", ".csv", ".ico", 0
202 };
203
204 auto dir = std::make_unique<FileItem>(
"/icons/yellow-folder-open.png",
206 "");
208 parent->appendRow(std::move(
dir));
210 try {
211 std::set<fs::path>
paths;
212
213 fs::directory_iterator
end_itr;
216
218 std::vector<fs::path>
dirs;
219
220 while (!
paths.empty()) {
221 fs::path
p = *
paths.begin();
223
224
225 if (fs::is_symlink(
p))
226 continue;
227
228
229 if (fs::is_regular(
p)) {
230 std::string
ext = fs::extension(
p);
235 break;
236 }
237
239 continue;
240 }
241
242
246
251
253 std::make_unique<FileItem>(
"/icons/cppclass.png",
label, std::string());
255
257 = std::make_unique<FileItem>(
"/icons/document.png",
filename(
p),
260 = std::make_unique<FileItem>("/icons/document.png",
262 (*it_companion).string());
265
268 } else {
270 = std::make_unique<FileItem>(
"/icons/document.png",
filename(
p),
273 }
274 }
else if (fs::is_directory(
p)) {
276 } else {
278 = std::make_unique<FileItem>(
"/icons/document.png",
filename(
p),
281 }
282 }
283
285
286 for (
unsigned int i = 0;
i <
classes.size();
i++)
287 parent->appendRow(std::move(
classes[
i]));
288
289 for (
unsigned int i = 0;
i <
files.size();
i++)
290 parent->appendRow(std::move(
files[
i]));
291
292 for (
unsigned int i = 0;
i <
dirs.size();
i++)
294 }
catch (fs::filesystem_error&
e) {
295 std::cerr <<
e.what() << std::endl;
296 }
297}
static fs::path getCompanion(const fs::path &path)
static std::string stem(const fs::path &p)
static std::string filename(const fs::path &p)
static bool comparePaths(const fs::path &p1, const fs::path &p2)
void cppTraverseDir(WStandardItem *parent, const boost::filesystem::path &path)
WStandardItem which stores a file.