MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / ResolveTextDictionaryPath

Function ResolveTextDictionaryPath

src/benchmark/Performance.cpp:157–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157std::string ResolveTextDictionaryPath(const std::string& dict_file_name) {
158 const std::string text_file_name =
159 ReplaceSuffix(dict_file_name, ".ocd2", ".txt");
160 const std::string source_path =
161 std::string(PROJECT_SOURCE_DIR) + "/data/dictionary/" + text_file_name;
162 if (IsRegularFile(source_path)) {
163 return source_path;
164 }
165
166 const std::string generated_path =
167 std::string(PROJECT_BINARY_DIR) + "/data/" + text_file_name;
168 if (IsRegularFile(generated_path)) {
169 return generated_path;
170 }
171
172 throw FileNotFound(text_file_name);
173}
174
175std::string ResolveSegmentationResourcePath(
176 const std::string& source_config_directory, const std::string& resource_path) {

Callers 1

RewriteDictNodeFunction · 0.85

Calls 2

ReplaceSuffixFunction · 0.85
IsRegularFileFunction · 0.70

Tested by

no test coverage detected