Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: chrome/browser/importer/firefox_importer_utils.cc

Issue 647016: importer: use FilePath instead of wstring in some places (Closed)
Patch Set: with fixes Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/firefox_importer_utils.h ('k') | chrome/browser/importer/importer_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/firefox_importer_utils.cc
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index 624a4e90bb71d72e75e2c11abda333f92789ea67..36a3741fc9e822f2e835eb3953c7cbd36581b5da 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -40,12 +40,11 @@ class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter {
};
} // namespace
-bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path,
+bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path,
int* version,
- std::wstring* app_path) {
+ FilePath* app_path) {
bool ret = false;
- std::wstring compatibility_file(profile_path);
- file_util::AppendToPath(&compatibility_file, L"compatibility.ini");
+ FilePath compatibility_file = profile_path.AppendASCII("compatibility.ini");
std::string content;
file_util::ReadFileToString(compatibility_file, &content);
ReplaceSubstringsAfterOffset(&content, 0, "\r\n", "\n");
@@ -63,14 +62,19 @@ bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path,
*version = line.substr(equal + 1)[0] - '0';
ret = true;
} else if (key == "LastAppDir") {
- *app_path = UTF8ToWide(line.substr(equal + 1));
+ // TODO(evanm): If the path in question isn't convertible to
+ // UTF-8, what does Firefox do? If it puts raw bytes in the
+ // file, we could go straight from bytes -> filepath;
+ // otherwise, we're out of luck here.
+ *app_path = FilePath::FromWStringHack(
+ UTF8ToWide(line.substr(equal + 1)));
}
}
}
return ret;
}
-void ParseProfileINI(std::wstring file, DictionaryValue* root) {
+void ParseProfileINI(const FilePath& file, DictionaryValue* root) {
// Reads the whole INI file.
std::string content;
file_util::ReadFileToString(file, &content);
« no previous file with comments | « chrome/browser/importer/firefox_importer_utils.h ('k') | chrome/browser/importer/importer_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698