summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 18:00:48 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 18:00:48 +0000
commite662113defd6298f0bae0323046a6d5251d7ecb7 (patch)
tree3d643d27e0643d3ecfa10c6e51a75e35db5dc027 /base
parentf35d39bd9a42f6aeffdfd2dc8efb4e0ea616baf9 (diff)
downloadchromium_src-e662113defd6298f0bae0323046a6d5251d7ecb7.zip
chromium_src-e662113defd6298f0bae0323046a6d5251d7ecb7.tar.gz
chromium_src-e662113defd6298f0bae0323046a6d5251d7ecb7.tar.bz2
a few unit tests broke on windows, fix those bugs
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@950 0039d316-1c4b-4281-b951-d872f2087c98
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);
}