aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/file.cc
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-12-19 14:30:52 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2016-12-19 16:15:50 +0000
commita4d0ea406e8622e305fc3253075cfee60da3d3d2 (patch)
tree3ae018781f294f50a391cd2f3423d919b4cedeb1 /src/main/cpp/util/file.cc
parent17380ac67da7860188f778209f144b4c401127a8 (diff)
Bazel client: SplitPath works with Windows paths
This allows correct behavior of Dirname and Basename on Windows. See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 142441234 MOS_MIGRATED_REVID=142441234
Diffstat (limited to 'src/main/cpp/util/file.cc')
-rw-r--r--src/main/cpp/util/file.cc12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/main/cpp/util/file.cc b/src/main/cpp/util/file.cc
index 2f6e6c66f2..392af372af 100644
--- a/src/main/cpp/util/file.cc
+++ b/src/main/cpp/util/file.cc
@@ -69,18 +69,6 @@ bool WriteFile(const std::string &content, const std::string &filename) {
return WriteFile(content.c_str(), content.size(), filename);
}
-pair<string, string> SplitPath(const string &path) {
- size_t pos = path.rfind('/');
-
- // Handle the case with no '/' in 'path'.
- if (pos == string::npos) return std::make_pair("", path);
-
- // Handle the case with a single leading '/' in 'path'.
- if (pos == 0) return std::make_pair(string(path, 0, 1), string(path, 1));
-
- return std::make_pair(string(path, 0, pos), string(path, pos + 1));
-}
-
string Dirname(const string &path) {
return SplitPath(path).first;
}