OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/tools/convert_dict/dic_reader.h" | 5 #include "chrome/tools/convert_dict/dic_reader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 return true; | 126 return true; |
127 } | 127 } |
128 | 128 |
129 } // namespace | 129 } // namespace |
130 | 130 |
131 DicReader::DicReader(const FilePath& path) { | 131 DicReader::DicReader(const FilePath& path) { |
132 file_ = file_util::OpenFile(path, "r"); | 132 file_ = file_util::OpenFile(path, "r"); |
133 | 133 |
134 FilePath additional_path = | 134 FilePath additional_path = |
135 path.InsertBeforeExtension(FILE_PATH_LITERAL("_delta")); | 135 path.ReplaceExtension(FILE_PATH_LITERAL("dic_delta")); |
136 additional_words_file_ = file_util::OpenFile(additional_path, "r"); | 136 additional_words_file_ = file_util::OpenFile(additional_path, "r"); |
| 137 |
| 138 if (additional_words_file_) |
| 139 printf("Reading %" PRFilePath " ...\n", additional_path.value().c_str()); |
| 140 else |
| 141 printf("%" PRFilePath " not found.\n", additional_path.value().c_str()); |
137 } | 142 } |
138 | 143 |
139 DicReader::~DicReader() { | 144 DicReader::~DicReader() { |
140 if (file_) | 145 if (file_) |
141 file_util::CloseFile(file_); | 146 file_util::CloseFile(file_); |
142 if (additional_words_file_) | 147 if (additional_words_file_) |
143 file_util::CloseFile(additional_words_file_); | 148 file_util::CloseFile(additional_words_file_); |
144 } | 149 } |
145 | 150 |
146 bool DicReader::Read(AffReader* aff_reader) { | 151 bool DicReader::Read(AffReader* aff_reader) { |
(...skipping 29 matching lines...) Expand all Loading... |
176 std::sort(affixes.begin(), affixes.end()); | 181 std::sort(affixes.begin(), affixes.end()); |
177 words_.push_back(std::make_pair(word->first, affixes)); | 182 words_.push_back(std::make_pair(word->first, affixes)); |
178 } | 183 } |
179 | 184 |
180 // Double-check that the words are sorted. | 185 // Double-check that the words are sorted. |
181 std::sort(words_.begin(), words_.end()); | 186 std::sort(words_.begin(), words_.end()); |
182 return true; | 187 return true; |
183 } | 188 } |
184 | 189 |
185 } // namespace convert_dict | 190 } // namespace convert_dict |
OLD | NEW |