This is an automated email from the ASF dual-hosted git repository. bennoe pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 85c5ca68922540ea4f8e74375ca0a636cf1cf67b Author: Benjamin Bannier <[email protected]> AuthorDate: Tue Jan 7 13:19:10 2020 +0100 Renamed stout's path-related absolute functions to is_absolute. Review: https://reviews.apache.org/r/71879/ --- .../include/stout/internal/windows/longpath.hpp | 2 +- 3rdparty/stout/include/stout/os/posix/copyfile.hpp | 4 +- .../stout/include/stout/os/windows/copyfile.hpp | 4 +- 3rdparty/stout/include/stout/path.hpp | 6 +- 3rdparty/stout/tests/path_tests.cpp | 64 +++++++++++----------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/3rdparty/stout/include/stout/internal/windows/longpath.hpp b/3rdparty/stout/include/stout/internal/windows/longpath.hpp index 499eef3..f5270b9 100644 --- a/3rdparty/stout/include/stout/internal/windows/longpath.hpp +++ b/3rdparty/stout/include/stout/internal/windows/longpath.hpp @@ -39,7 +39,7 @@ inline std::wstring longpath(const std::string& path) { const size_t max_path_length = 248; if (path.size() >= max_path_length && - path::absolute(path) && + path::is_absolute(path) && !strings::startsWith(path, os::LONGPATH_PREFIX)) { return wide_stringify(os::LONGPATH_PREFIX + path); } else { diff --git a/3rdparty/stout/include/stout/os/posix/copyfile.hpp b/3rdparty/stout/include/stout/os/posix/copyfile.hpp index 631babc..40b9e47 100644 --- a/3rdparty/stout/include/stout/os/posix/copyfile.hpp +++ b/3rdparty/stout/include/stout/os/posix/copyfile.hpp @@ -50,11 +50,11 @@ inline Try<Nothing> copyfile( return Error("`destination` was a directory"); } - if (!path::absolute(source)) { + if (!path::is_absolute(source)) { return Error("`source` was a relative path"); } - if (!path::absolute(destination)) { + if (!path::is_absolute(destination)) { return Error("`destination` was a relative path"); } diff --git a/3rdparty/stout/include/stout/os/windows/copyfile.hpp b/3rdparty/stout/include/stout/os/windows/copyfile.hpp index 34723bc..2778991 100644 --- a/3rdparty/stout/include/stout/os/windows/copyfile.hpp +++ b/3rdparty/stout/include/stout/os/windows/copyfile.hpp @@ -38,11 +38,11 @@ namespace os { inline Try<Nothing> copyfile( const std::string& source, const std::string& destination) { - if (!path::absolute(source)) { + if (!path::is_absolute(source)) { return Error("`source` was a relative path"); } - if (!path::absolute(destination)) { + if (!path::is_absolute(destination)) { return Error("`destination` was a relative path"); } diff --git a/3rdparty/stout/include/stout/path.hpp b/3rdparty/stout/include/stout/path.hpp index 0aa3b01..0338bf9 100644 --- a/3rdparty/stout/include/stout/path.hpp +++ b/3rdparty/stout/include/stout/path.hpp @@ -152,7 +152,7 @@ inline std::string join(const std::vector<std::string>& paths) * Returns whether the given path is an absolute path. * If an invalid path is given, the return result is also invalid. */ -inline bool absolute(const std::string& path) +inline bool is_absolute(const std::string& path) { #ifndef __WINDOWS__ return strings::startsWith(path, os::PATH_SEPARATOR); @@ -365,9 +365,9 @@ public: } // Checks whether the path is absolute. - inline bool absolute() const + inline bool is_absolute() const { - return path::absolute(value); + return path::is_absolute(value); } // Implicit conversion from Path to string. diff --git a/3rdparty/stout/tests/path_tests.cpp b/3rdparty/stout/tests/path_tests.cpp index 41c5f6c..c5135a4 100644 --- a/3rdparty/stout/tests/path_tests.cpp +++ b/3rdparty/stout/tests/path_tests.cpp @@ -308,48 +308,48 @@ TEST(PathTest, Join) } -TEST(PathTest, Absolute) +TEST(PathTest, IsAbsolute) { #ifdef __WINDOWS__ // Check absolute paths. - EXPECT_TRUE(path::absolute("C:\\foo\\bar\\baz")); - EXPECT_TRUE(path::absolute("c:\\")); - EXPECT_TRUE(path::absolute("C:/")); - EXPECT_TRUE(path::absolute("c:/")); - EXPECT_TRUE(path::absolute("X:\\foo")); - EXPECT_TRUE(path::absolute("X:\\foo")); - EXPECT_TRUE(path::absolute("y:\\bar")); - EXPECT_TRUE(path::absolute("y:/bar")); - EXPECT_TRUE(path::absolute("\\\\?\\")); - EXPECT_TRUE(path::absolute("\\\\?\\C:\\Program Files")); - EXPECT_TRUE(path::absolute("\\\\?\\C:/Program Files")); - EXPECT_TRUE(path::absolute("\\\\?\\C:\\Path")); - EXPECT_TRUE(path::absolute("\\\\server\\share")); + EXPECT_TRUE(path::is_absolute("C:\\foo\\bar\\baz")); + EXPECT_TRUE(path::is_absolute("c:\\")); + EXPECT_TRUE(path::is_absolute("C:/")); + EXPECT_TRUE(path::is_absolute("c:/")); + EXPECT_TRUE(path::is_absolute("X:\\foo")); + EXPECT_TRUE(path::is_absolute("X:\\foo")); + EXPECT_TRUE(path::is_absolute("y:\\bar")); + EXPECT_TRUE(path::is_absolute("y:/bar")); + EXPECT_TRUE(path::is_absolute("\\\\?\\")); + EXPECT_TRUE(path::is_absolute("\\\\?\\C:\\Program Files")); + EXPECT_TRUE(path::is_absolute("\\\\?\\C:/Program Files")); + EXPECT_TRUE(path::is_absolute("\\\\?\\C:\\Path")); + EXPECT_TRUE(path::is_absolute("\\\\server\\share")); // Check invalid paths. - EXPECT_FALSE(path::absolute("abc:/")); - EXPECT_FALSE(path::absolute("1:/")); - EXPECT_TRUE(path::absolute("\\\\?\\relative")); + EXPECT_FALSE(path::is_absolute("abc:/")); + EXPECT_FALSE(path::is_absolute("1:/")); + EXPECT_TRUE(path::is_absolute("\\\\?\\relative")); // Check relative paths. - EXPECT_FALSE(path::absolute("relative")); - EXPECT_FALSE(path::absolute("\\file-without-disk")); - EXPECT_FALSE(path::absolute("/file-without-disk")); - EXPECT_FALSE(path::absolute("N:file-without-dir")); + EXPECT_FALSE(path::is_absolute("relative")); + EXPECT_FALSE(path::is_absolute("\\file-without-disk")); + EXPECT_FALSE(path::is_absolute("/file-without-disk")); + EXPECT_FALSE(path::is_absolute("N:file-without-dir")); #else // Check absolute paths. - EXPECT_TRUE(path::absolute("/")); - EXPECT_TRUE(path::absolute("/foo")); - EXPECT_TRUE(path::absolute("/foo/bar")); - EXPECT_TRUE(path::absolute("/foo/bar/../baz")); + EXPECT_TRUE(path::is_absolute("/")); + EXPECT_TRUE(path::is_absolute("/foo")); + EXPECT_TRUE(path::is_absolute("/foo/bar")); + EXPECT_TRUE(path::is_absolute("/foo/bar/../baz")); // Check relative paths. - EXPECT_FALSE(path::absolute("")); - EXPECT_FALSE(path::absolute(".")); - EXPECT_FALSE(path::absolute("..")); - EXPECT_FALSE(path::absolute("../")); - EXPECT_FALSE(path::absolute("./foo")); - EXPECT_FALSE(path::absolute("../foo")); + EXPECT_FALSE(path::is_absolute("")); + EXPECT_FALSE(path::is_absolute(".")); + EXPECT_FALSE(path::is_absolute("..")); + EXPECT_FALSE(path::is_absolute("../")); + EXPECT_FALSE(path::is_absolute("./foo")); + EXPECT_FALSE(path::is_absolute("../foo")); #endif // __WINDOWS__ } @@ -429,7 +429,7 @@ TEST(PathTest, PathIteration) const Path absolute_path( strings::join(string(1, os::PATH_SEPARATOR), components)); - ASSERT_TRUE(absolute_path.absolute()); + ASSERT_TRUE(absolute_path.is_absolute()); EXPECT_NE(absolute_path.begin(), absolute_path.end()); EXPECT_EQ(
