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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 found->second.insert(affix_index); | 122 found->second.insert(affix_index); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 return true; | 126 return true; |
127 } | 127 } |
128 | 128 |
129 } // namespace | 129 } // namespace |
130 | 130 |
131 DicReader::DicReader(const std::string& filename) { | 131 DicReader::DicReader(const std::string& filename) { |
132 file_ = file_util::OpenFile(filename, "r"); | 132 FilePath path = FilePath::FromWStringHack(ASCIIToWide(filename)); |
133 additional_words_file_ = file_util::OpenFile(filename + "_delta", "r"); | 133 file_ = file_util::OpenFile(path, "r"); |
Nico
2010/07/08 17:37:28
also followup change?
| |
134 additional_words_file_ = | |
135 file_util::OpenFile(FilePath(path.value() + FILE_PATH_LITERAL("_delta")), | |
Nico
2010/07/08 17:37:28
InsertBeforeExtension?
| |
136 "r"); | |
134 } | 137 } |
135 | 138 |
136 DicReader::~DicReader() { | 139 DicReader::~DicReader() { |
137 if (file_) | 140 if (file_) |
138 file_util::CloseFile(file_); | 141 file_util::CloseFile(file_); |
139 if (additional_words_file_) | 142 if (additional_words_file_) |
140 file_util::CloseFile(additional_words_file_); | 143 file_util::CloseFile(additional_words_file_); |
141 } | 144 } |
142 | 145 |
143 bool DicReader::Read(AffReader* aff_reader) { | 146 bool DicReader::Read(AffReader* aff_reader) { |
(...skipping 29 matching lines...) Expand all Loading... | |
173 std::sort(affixes.begin(), affixes.end()); | 176 std::sort(affixes.begin(), affixes.end()); |
174 words_.push_back(std::make_pair(word->first, affixes)); | 177 words_.push_back(std::make_pair(word->first, affixes)); |
175 } | 178 } |
176 | 179 |
177 // Double-check that the words are sorted. | 180 // Double-check that the words are sorted. |
178 std::sort(words_.begin(), words_.end()); | 181 std::sort(words_.begin(), words_.end()); |
179 return true; | 182 return true; |
180 } | 183 } |
181 | 184 |
182 } // namespace convert_dict | 185 } // namespace convert_dict |
OLD | NEW |