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

Unified Diff: chrome/tools/convert_dict/convert_dict.cc

Issue 2929002: Convert some tools to use FilePaths for file names. (Closed)
Patch Set: ok Created 10 years, 5 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/tools/convert_dict/aff_reader.cc ('k') | chrome/tools/convert_dict/convert_dict_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/tools/convert_dict/convert_dict.cc
diff --git a/chrome/tools/convert_dict/convert_dict.cc b/chrome/tools/convert_dict/convert_dict.cc
index f4001553d8e202012b0b6e78e6f6f5553293e00a..6b4ab1716aa5399f483a13eb87a92ddbc9abba9c 100644
--- a/chrome/tools/convert_dict/convert_dict.cc
+++ b/chrome/tools/convert_dict/convert_dict.cc
@@ -14,6 +14,7 @@
#include <stdio.h>
#include "base/at_exit.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/i18n/icu_util.h"
#include "base/logging.h"
@@ -82,7 +83,11 @@ int PrintHelp() {
} // namespace
+#if defined(OS_WIN)
+int wmain(int argc, wchar_t* argv[]) {
+#else
int main(int argc, char* argv[]) {
+#endif
base::EnableTerminationOnHeapCorruption();
if (argc != 2)
return PrintHelp();
@@ -90,19 +95,19 @@ int main(int argc, char* argv[]) {
base::AtExitManager exit_manager;
icu_util::Initialize();
- std::string file_base = argv[1];
+ FilePath file_base = FilePath(argv[1]);
- std::string aff_name = file_base + ".aff";
- printf("Reading %s ...\n", aff_name.c_str());
- convert_dict::AffReader aff_reader(aff_name.c_str());
+ FilePath aff_path = file_base.ReplaceExtension(FILE_PATH_LITERAL(".aff"));
+ printf("Reading %" PRFilePath " ...\n", aff_path.value().c_str());
+ convert_dict::AffReader aff_reader(aff_path);
if (!aff_reader.Read()) {
printf("Unable to read the aff file.\n");
return 1;
}
- std::string dic_name = file_base + ".dic";
- printf("Reading %s ...\n", dic_name.c_str());
- convert_dict::DicReader dic_reader(dic_name.c_str());
+ FilePath dic_path = file_base.ReplaceExtension(FILE_PATH_LITERAL(".dic"));
+ printf("Reading %" PRFilePath " ...\n", dic_path.value().c_str());
+ convert_dict::DicReader dic_reader(dic_path);
if (!dic_reader.Read(&aff_reader)) {
printf("Unable to read the dic file.\n");
return 1;
@@ -125,9 +130,9 @@ int main(int argc, char* argv[]) {
return 1;
}
- std::string out_name = file_base + ".bdic";
- printf("Writing %s ...\n", out_name.c_str());
- FILE* out_file = file_util::OpenFile(out_name, "wb");
+ FilePath out_path = file_base.ReplaceExtension(FILE_PATH_LITERAL(".bdic"));
+ printf("Writing %" PRFilePath " ...\n", out_path.value().c_str());
+ FILE* out_file = file_util::OpenFile(out_path, "wb");
if (!out_file) {
printf("ERROR writing file\n");
return 1;
« no previous file with comments | « chrome/tools/convert_dict/aff_reader.cc ('k') | chrome/tools/convert_dict/convert_dict_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698