diff --git a/src/filesystem.cc b/src/filesystem.cc index 37907ef..43357ed 100644 --- a/src/filesystem.cc +++ b/src/filesystem.cc @@ -169,38 +169,3 @@ bool filesystem::write(const std::string &path, Glib::RefPtr bu } return false; } - -std::vector filesystem::get_directory_content(const boost::filesystem::path &path, int filter) { - std::vector dirs; - if (boost::filesystem::is_directory(path)) { - for (boost::filesystem::directory_iterator it(path); it != boost::filesystem::directory_iterator(); it++) { - if (filter & DIRS && boost::filesystem::is_directory(it->path())) - dirs.emplace_back(it->path()); - if (filter & FILES && boost::filesystem::is_regular_file(it->path())) - dirs.emplace_back(it->path()); - } - } - if (filter & SORTED) - std::sort(dirs.begin(), dirs.end()); - return dirs; -}; - -std::vector filesystem::dirs(const boost::filesystem::path &path) { - return filesystem::get_directory_content(path, DIRS | SORTED); -} - -std::vector filesystem::files(const boost::filesystem::path &path) { - return filesystem::get_directory_content(path, FILES | SORTED); -} - -std::vector filesystem::contents(const boost::filesystem::path &path) { - return filesystem::get_directory_content(path, ALL | SORTED); -} - -std::vector filesystem::seperate_contents(const boost::filesystem::path &path) { - auto a = dirs(path); - auto b = files(path); - a.insert(a.end(), b.begin(), b.end()); - return a; -} - diff --git a/src/filesystem.h b/src/filesystem.h index 4472a12..1a81a7d 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -5,13 +5,6 @@ #include #include -enum filesystem_options { - DIRS = 1, - FILES = 2, - ALL = DIRS | FILES, - SORTED = 4 -}; - class filesystem { public: static std::string read(const std::string &path); @@ -31,11 +24,6 @@ public: static bool write(const boost::filesystem::path &path) { return write(path, ""); }; static bool write(const std::string &path, Glib::RefPtr text_buffer); static bool write(const boost::filesystem::path &path, Glib::RefPtr text_buffer) { return write(path.string(), text_buffer); } - static std::vector get_directory_content(const boost::filesystem::path &path, int filter); - static std::vector dirs(const boost::filesystem::path &path); - static std::vector files(const boost::filesystem::path &path); - static std::vector contents(const boost::filesystem::path &path); - static std::vector seperate_contents(const boost::filesystem::path &path); static std::string get_home_folder(); static std::string get_tmp_folder();