summaryrefslogtreecommitdiffstats
path: root/base/file_path.cc
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-06-09 11:47:42 +0100
committerKristian Monsen <kristianm@google.com>2011-06-29 14:33:03 +0100
commitdc0f95d653279beabeb9817299e2902918ba123e (patch)
tree32eb121cd532053a5b9cb0c390331349af8d6baa /base/file_path.cc
parentba160cd4054d13d0cb0b1b46e61c3bed67095811 (diff)
downloadexternal_chromium-dc0f95d653279beabeb9817299e2902918ba123e.zip
external_chromium-dc0f95d653279beabeb9817299e2902918ba123e.tar.gz
external_chromium-dc0f95d653279beabeb9817299e2902918ba123e.tar.bz2
Merge Chromium at r11.0.696.0: Initial merge by git
Change-Id: I273dde2843af0839dfc08b419bb443fbd449532d
Diffstat (limited to 'base/file_path.cc')
-rw-r--r--base/file_path.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/base/file_path.cc b/base/file_path.cc
index 5f1375a..29ec7a8 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -249,9 +249,8 @@ bool FilePath::AppendRelativePath(const FilePath& child,
GetComponents(&parent_components);
child.GetComponents(&child_components);
- if (parent_components.size() >= child_components.size())
- return false;
- if (parent_components.size() == 0)
+ if (parent_components.empty() ||
+ parent_components.size() >= child_components.size())
return false;
std::vector<StringType>::const_iterator parent_comp =
@@ -520,6 +519,12 @@ string16 FilePath::LossyDisplayName() const {
return WideToUTF16(base::SysNativeMBToWide(path_));
}
+std::string FilePath::MaybeAsASCII() const {
+ if (IsStringASCII(path_))
+ return path_;
+ return "";
+}
+
// The *Hack functions are temporary while we fix the remainder of the code.
// Remember to remove the #includes at the top when you remove these.
@@ -535,6 +540,12 @@ string16 FilePath::LossyDisplayName() const {
return path_;
}
+std::string FilePath::MaybeAsASCII() const {
+ if (IsStringASCII(path_))
+ return WideToASCII(path_);
+ return "";
+}
+
// static
FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
return FilePath(wstring);