You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/07/11 01:39:09 UTC
[23/50] mesos git commit: Windows: Updated `fs::list()` to support
long paths.
Windows: Updated `fs::list()` to support long paths.
Review: https://reviews.apache.org/r/60321/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d472f8af
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d472f8af
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d472f8af
Branch: refs/heads/master
Commit: d472f8af9166743d1ea27219553d93fc782177dd
Parents: 04054e0
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Jul 10 10:42:38 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jul 10 17:15:35 2017 -0700
----------------------------------------------------------------------
3rdparty/stout/include/stout/windows/fs.hpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d472f8af/3rdparty/stout/include/stout/windows/fs.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/fs.hpp b/3rdparty/stout/include/stout/windows/fs.hpp
index 7c3413b..4e156a9 100644
--- a/3rdparty/stout/include/stout/windows/fs.hpp
+++ b/3rdparty/stout/include/stout/windows/fs.hpp
@@ -19,6 +19,7 @@
#include <stout/error.hpp>
#include <stout/nothing.hpp>
#include <stout/try.hpp>
+#include <stout/windows.hpp>
#include <stout/internal/windows/symlink.hpp>
@@ -89,10 +90,12 @@ inline Try<Nothing> symlink(
inline Try<std::list<std::string>> list(const std::string& pattern)
{
std::list<std::string> found_files;
- WIN32_FIND_DATA find_data;
- const HANDLE search_handle = ::FindFirstFile(pattern.c_str(), &find_data);
+ WIN32_FIND_DATAW found;
+ const SharedHandle search_handle(
+ ::FindFirstFileW(wide_stringify(pattern).data(), &found),
+ ::FindClose);
- if (search_handle == INVALID_HANDLE_VALUE) {
+ if (search_handle.get() == INVALID_HANDLE_VALUE) {
// For compliance with the POSIX implementation (which uses `::glob`),
// return an empty list instead of an error when the path does not exist.
int error = ::GetLastError();
@@ -106,18 +109,15 @@ inline Try<std::list<std::string>> list(const std::string& pattern)
}
do {
- const std::string current_file(find_data.cFileName);
+ const std::wstring current_file(found.cFileName);
- // Ignore `.` and `..` entries
- if (current_file.compare(".") != 0 && current_file.compare("..") != 0) {
- found_files.push_back(current_file);
+ // Ignore `.` and `..` entries.
+ if (current_file.compare(L".") != 0 && current_file.compare(L"..") != 0) {
+ found_files.push_back(stringify(current_file));
}
- } while (::FindNextFile(search_handle, &find_data));
+ } while (::FindNextFileW(search_handle.get(), &found));
- // Cache `FindNextFile` error, `FindClose` will overwrite it
const DWORD error = ::GetLastError();
- ::FindClose(search_handle);
-
if (error != ERROR_NO_MORE_FILES) {
return WindowsError(
error,