Index: base/file_path.cc |
diff --git a/base/file_path.cc b/base/file_path.cc |
index 35361bef7594c5e2223343d46d4ec745edec3675..1689986d703c5b8b5956c895b4d086860481fa85 100644 |
--- a/base/file_path.cc |
+++ b/base/file_path.cc |
@@ -527,6 +527,10 @@ std::string FilePath::MaybeAsASCII() const { |
return ""; |
} |
+std::string FilePath::AsUTF8Unsafe() const { |
+ return WideToUTF8(base::SysNativeMBToWide(value())); |
Mark Mentovai
2011/11/01 21:30:46
Per the comment I made in the header, avoid SysNat
satorux1
2011/11/01 21:49:55
Done.
|
+} |
+ |
// 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. |
@@ -534,6 +538,12 @@ std::string FilePath::MaybeAsASCII() const { |
FilePath FilePath::FromWStringHack(const std::wstring& wstring) { |
return FilePath(base::SysWideToNativeMB(wstring)); |
} |
+ |
+// static |
+FilePath FilePath::FromUTF8Unsafe(const std::string& utf8) { |
+ return FilePath(base::SysWideToNativeMB(UTF8ToWide(utf8))); |
+} |
+ |
#elif defined(OS_WIN) |
string16 FilePath::LossyDisplayName() const { |
return path_; |
@@ -545,10 +555,19 @@ std::string FilePath::MaybeAsASCII() const { |
return ""; |
} |
+std::string FilePath::AsUTF8Unsafe() const { |
+ return WideToUTF8(value()); |
+} |
+ |
// static |
FilePath FilePath::FromWStringHack(const std::wstring& wstring) { |
return FilePath(wstring); |
} |
+ |
+// static |
+FilePath FilePath::FromUTF8Unsafe(const std::string& utf8) { |
+ return FilePath(UTF8ToWide(utf8)); |
+} |
#endif |
void FilePath::WriteToPickle(Pickle* pickle) { |