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:07 UTC

[21/50] mesos git commit: Windows: Updated `os::rm()` to support long paths.

Windows: Updated `os::rm()` to support long paths.

Review: https://reviews.apache.org/r/60313/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f2db53f2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f2db53f2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f2db53f2

Branch: refs/heads/master
Commit: f2db53f28d36a368e200f19436ac346465553f2c
Parents: 06162f6
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Fri Jul 7 14:45:48 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jul 10 17:15:34 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/windows/rm.hpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f2db53f2/3rdparty/stout/include/stout/os/windows/rm.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/rm.hpp b/3rdparty/stout/include/stout/os/windows/rm.hpp
index 6460b52..73ebcec 100644
--- a/3rdparty/stout/include/stout/os/windows/rm.hpp
+++ b/3rdparty/stout/include/stout/os/windows/rm.hpp
@@ -23,6 +23,8 @@
 
 #include <stout/os/stat.hpp>
 
+#include <stout/internal/windows/longpath.hpp>
+
 
 namespace os {
 
@@ -43,8 +45,10 @@ inline Try<Nothing> rm(const std::string& path)
   // [2] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365682(v=vs.85).aspx#deletefile_and_deletefiletransacted
   // [3] http://pubs.opengroup.org/onlinepubs/009695399/functions/remove.html
   // [4] http://pubs.opengroup.org/onlinepubs/009695399/functions/rmdir.html
-  const BOOL result = os::stat::isdir(path) ? ::RemoveDirectory(path.c_str())
-                                            : ::DeleteFile(path.c_str());
+  const std::wstring longpath = ::internal::windows::longpath(path);
+  const BOOL result = os::stat::isdir(path)
+      ? ::RemoveDirectoryW(longpath.data())
+      : ::DeleteFileW(longpath.data());
 
   if (!result) {
     return WindowsError("`os::rm` could not remove '" + path + "'");