You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2017/12/09 02:36:09 UTC
[07/11] mesos git commit: Added `uri::FILE_PREFIX` constant for
"file://".
Added `uri::FILE_PREFIX` constant for "file://".
Instead of hard-coding the string multiple times.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/245af401
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/245af401
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/245af401
Branch: refs/heads/master
Commit: 245af401f5177d2e2f79e93bf3e8bca7f15aa5ba
Parents: d417cd9
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Fri Dec 8 16:03:56 2017 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Fri Dec 8 16:35:40 2017 -0800
----------------------------------------------------------------------
3rdparty/stout/include/stout/uri.hpp | 7 +++++--
3rdparty/stout/tests/uri_tests.cpp | 8 +++++---
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/245af401/3rdparty/stout/include/stout/uri.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/uri.hpp b/3rdparty/stout/include/stout/uri.hpp
index becfd9f..88d959b 100644
--- a/3rdparty/stout/include/stout/uri.hpp
+++ b/3rdparty/stout/include/stout/uri.hpp
@@ -20,6 +20,9 @@
namespace uri {
+const std::string FILE_PREFIX = "file://";
+
+
// Returns a valid URI containing a filename.
//
// On Windows, the / character is replaced with \ since that's the path
@@ -28,9 +31,9 @@ namespace uri {
inline std::string from_path(const std::string& filepath)
{
#ifdef __WINDOWS__
- return "file://" + strings::replace(filepath, "\\", "/");
+ return FILE_PREFIX + strings::replace(filepath, "\\", "/");
#else
- return "file://" + filepath;
+ return FILE_PREFIX + filepath;
#endif // __WINDOWS__
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/245af401/3rdparty/stout/tests/uri_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/uri_tests.cpp b/3rdparty/stout/tests/uri_tests.cpp
index 70fa123..3656f30 100644
--- a/3rdparty/stout/tests/uri_tests.cpp
+++ b/3rdparty/stout/tests/uri_tests.cpp
@@ -17,13 +17,15 @@
TEST(UriTest, TestUriFromPath)
{
- EXPECT_EQ("file://", uri::from_path(""));
+ EXPECT_EQ(uri::FILE_PREFIX, uri::from_path(""));
+
EXPECT_EQ(
- "file:///absolute/path/on/linux",
+ uri::FILE_PREFIX + "/absolute/path/on/linux",
uri::from_path("/absolute/path/on/linux"));
#ifdef __WINDOWS__
EXPECT_EQ(
- "file://C:/somedir/somefile", uri::from_path("C:\\somedir\\somefile"));
+ uri::FILE_PREFIX + "C:/somedir/somefile",
+ uri::from_path("C:\\somedir\\somefile"));
#endif // __WINDOWS__
}