29 #include <Pluma/Dir.hpp>
30 #include <Pluma/uce-dirent.h>
41 void listFiles(std::list<std::string>& list,
const std::string& folder,
const std::string& extension,
bool recursive){
46 dir = opendir(folder.c_str());
49 fprintf(stderr,
"Could not open \"%s\" directory.\n", folder.c_str());
56 std::queue<std::string> folders;
60 while (!folders.empty()){
61 std::string currFolder = folders.front();
63 dir = opendir(currFolder.c_str());
64 if (dir == NULL)
continue;
66 while ((ent = readdir (dir)) != NULL) {
67 std::string name(ent->d_name);
69 if ( name.compare(
".") == 0 || name.compare(
"..") == 0)
continue;
71 std::string path = currFolder;
75 subDir = opendir(path.c_str());
79 if (recursive) folders.push(path);
82 if (extension.empty()){
86 size_t lastDot = name.find_last_of(
'.');
87 std::string ext = name.substr(lastDot+1);
88 if (ext.compare(extension) == 0){