+
+//==========================================================================
+
+std::vector<bf::path> getFileList(const std::string& path)
+{
+ std::vector<bf::path> files;
+
+ bf::path pth(path.c_str());
+ if(bf::exists(pth) && bf::is_directory(pth))
+ {
+ bf::directory_iterator end_itr;
+ for(bf::directory_iterator itr(pth); itr != end_itr; ++itr)
+ {
+ if(!is_directory(itr->status()))
+ {
+ std::string nm(itr->path().filename().string());
+ if(nm.substr(nm.size()-4) == ".bbs")
+ {
+ //std::cout << itr->path().filename().string() << std::endl;
+ files.push_back(itr->path());
+ }
+ }
+ }
+ }
+ else
+ {
+ std::cout<< "the path to the bbs's should be a folder and not a file.";
+ return files;
+ }
+
+ // Order files by name
+ for (int i = 0; i < (int)files.size()-1; ++i) {
+ for (int j = i+1; j < (int)files.size(); ++j) {
+ if(files[j].filename().string() < files[i].filename().string())
+ {
+ bf::path tmp = files[i];
+ files[i] = files[j];
+ files[j] = tmp;
+ }
+ }
+ }
+
+ return files;
+}