diff --git a/src/fs.cpp b/src/fs.cpp new file mode 100644 index 0000000..a8aeae3 --- /dev/null +++ b/src/fs.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +#include +#include + +#include "fs.hpp" + +using namespace std; + +vector cellar::fs::listdir(string path) { + vector result; + boost::filesystem::path cwd(path); + boost::filesystem::directory_iterator iter_end; + + for (boost::filesystem::directory_iterator iter_cwd(cwd); iter_cwd != iter_end; ++iter_cwd) { + try { + string item = iter_cwd->path().filename().native(); + + result.push_back(item); + } + catch (const exception& exc) { + cout << "fuck" << endl; + } + } + return result; +} + diff --git a/src/fs.hpp b/src/fs.hpp new file mode 100644 index 0000000..fdb618e --- /dev/null +++ b/src/fs.hpp @@ -0,0 +1,16 @@ +#ifndef __FS_HPP +#define __FS_HPP +#pragma once + +#include +#include + +using namespace std; + +namespace cellar { + namespace fs { + extern vector listdir(string path); + } +} + +#endif // __FS_HPP