summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/file_util.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index 4594144..fabb4ac 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -70,7 +70,8 @@ bool EndsWithSeparator(std::wstring* path) {
}
bool EndsWithSeparator(const std::wstring& path) {
- bool is_sep = ((path)[path.length() - 1] == kPathSeparator);
+ bool is_sep = (path.length() > 0 &&
+ (path)[path.length() - 1] == kPathSeparator);
return is_sep;
}
@@ -108,7 +109,9 @@ void TrimFilename(std::wstring* path) {
}
std::wstring GetFilenameFromPath(const std::wstring& path) {
- std::wstring::size_type pos = path.find_last_of(kPathSeparator);
+ // TODO(erikkay): fix this - it's not using kPathSeparator, but win unit test
+ // are exercising '/' as a path separator as well.
+ std::wstring::size_type pos = path.find_last_of(L"\\/");
return std::wstring(path, pos == std::wstring::npos ? 0 : pos+1);
}