| 189 | } |
| 190 | |
| 191 | std::string FindOcd2DictionaryDir(const std::string& configTestDirPath) { |
| 192 | std::vector<fs::path> candidates; |
| 193 | if (!PACKAGE_DATA_DIRECTORY.empty()) { |
| 194 | candidates.push_back(fs::u8path(PACKAGE_DATA_DIRECTORY)); |
| 195 | } |
| 196 | |
| 197 | const fs::path configDir = fs::u8path(configTestDirPath); |
| 198 | candidates.push_back(configDir.parent_path().parent_path() / "data" / |
| 199 | "dictionary"); |
| 200 | candidates.push_back(fs::current_path() / "data" / "dictionary"); |
| 201 | candidates.push_back(fs::current_path().parent_path() / "data" / "dictionary"); |
| 202 | |
| 203 | for (const fs::path& candidate : candidates) { |
| 204 | if (candidate.empty()) { |
| 205 | continue; |
| 206 | } |
| 207 | const fs::path phrases = candidate / "STPhrases.ocd2"; |
| 208 | const fs::path characters = candidate / "STCharacters.ocd2"; |
| 209 | if (fs::is_regular_file(phrases) && fs::is_regular_file(characters)) { |
| 210 | return PathString(candidate) + "/"; |
| 211 | } |
| 212 | } |
| 213 | return ""; |
| 214 | } |
| 215 | |
| 216 | } // namespace |
| 217 |
no test coverage detected