summaryrefslogtreecommitdiffstats
path: root/base/file_path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/file_path.cc')
-rw-r--r--base/file_path.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/base/file_path.cc b/base/file_path.cc
index e330e3c..7ced608 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -1102,6 +1102,22 @@ std::wstring FilePath::ToWStringHack() const {
}
#endif
+FilePath FilePath::FromString(const std::string& string) {
+#if defined(OS_POSIX)
+ return FilePath(string);
+#elif defined(OS_WIN)
+ return FilePath(base::SysUTF8ToWide(string));
+#endif
+}
+
+std::string FilePath::ToString() const {
+#if defined(OS_POSIX)
+ return value();
+#elif defined(OS_WIN)
+ return base::SysWideToUTF8(value());
+#endif
+}
+
FilePath FilePath::StripTrailingSeparators() const {
FilePath new_path(path_);
new_path.StripTrailingSeparatorsInternal();