13 #ifndef __STOUT_OS_WINDOWS_LS_HPP__ 14 #define __STOUT_OS_WINDOWS_LS_HPP__ 30 std::string
path = directory;
36 WIN32_FIND_DATAW found;
37 const std::wstring search_pattern =
41 ::FindFirstFileW(search_pattern.data(), &found),
44 if (search_handle.get() == INVALID_HANDLE_VALUE) {
45 return WindowsError(
"Failed to search '" + directory +
"'");
48 std::list<std::string> result;
53 const std::wstring current_file(found.cFileName);
55 const bool is_current_directory = current_file.compare(L
".") == 0;
56 const bool is_parent_directory = current_file.compare(L
"..") == 0;
59 if (is_current_directory || is_parent_directory) {
63 result.push_back(
stringify(current_file));
64 }
while (::FindNextFileW(search_handle.get(), &found));
71 #endif // __STOUT_OS_WINDOWS_LS_HPP__ bool endsWith(const std::string &s, const std::string &suffix)
Definition: strings.hpp:402
Definition: windows.hpp:72
Definition: error.hpp:108
Definition: posix_signalhandler.hpp:23
std::wstring longpath(const std::string &path)
Definition: longpath.hpp:38
std::string stringify(int flags)
Try< std::list< std::string > > ls(const std::string &directory)
Definition: ls.hpp:29