13 #ifndef __STOUT_OS_FIND_HPP__ 14 #define __STOUT_OS_FIND_HPP__ 38 const std::string& directory,
39 const std::string& pattern)
41 std::list<std::string> results;
44 return Error(
"'" + directory +
"' is not a directory");
49 foreach (
const std::string& entry, entries.
get()) {
57 foreach (
const std::string& match, matches.
get()) {
58 results.push_back(match);
61 if (entry.find(pattern) != std::string::npos) {
62 results.push_back(path);
73 #endif // __STOUT_OS_FIND_HPP__
Definition: errorbase.hpp:36
T & get()&
Definition: try.hpp:80
bool islink(const std::string &path)
Definition: stat.hpp:80
Definition: posix_signalhandler.hpp:23
std::string join(const std::string &path1, const std::string &path2, const char _separator=os::PATH_SEPARATOR)
Definition: path.hpp:116
bool isSome() const
Definition: try.hpp:77
bool isError() const
Definition: try.hpp:78
bool isdir(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:91
Try< std::list< std::string > > find(const std::string &directory, const std::string &pattern)
Definition: find.hpp:37
Try< std::list< std::string > > ls(const std::string &directory)
Definition: ls.hpp:29