| 173 | } |
| 174 | |
| 175 | std::string ResolveSegmentationResourcePath( |
| 176 | const std::string& source_config_directory, const std::string& resource_path) { |
| 177 | if (IsAbsolutePath(resource_path)) { |
| 178 | return resource_path; |
| 179 | } |
| 180 | |
| 181 | #ifdef OPENCC_BENCHMARK_JIEBA_CONFIG_DIR |
| 182 | if (resource_path.find("jieba_dict/") == 0) { |
| 183 | const std::string basename = |
| 184 | resource_path.substr(std::string("jieba_dict/").size()); |
| 185 | const std::string plugin_build_path = |
| 186 | JoinPath(std::string(OPENCC_BENCHMARK_JIEBA_PLUGIN_DIR), resource_path); |
| 187 | if (IsRegularFile(plugin_build_path)) { |
| 188 | return plugin_build_path; |
| 189 | } |
| 190 | const std::string plugin_parent_path = |
| 191 | JoinPath(GetParentDirectory(OPENCC_BENCHMARK_JIEBA_PLUGIN_DIR), resource_path); |
| 192 | if (IsRegularFile(plugin_parent_path)) { |
| 193 | return plugin_parent_path; |
| 194 | } |
| 195 | const std::string source_jieba_path = |
| 196 | std::string(PROJECT_SOURCE_DIR) + "/plugins/jieba/deps/cppjieba/dict/" + |
| 197 | basename; |
| 198 | if (IsRegularFile(source_jieba_path)) { |
| 199 | return source_jieba_path; |
| 200 | } |
| 201 | } |
| 202 | #endif |
| 203 | |
| 204 | return JoinPath(source_config_directory, resource_path); |
| 205 | } |
| 206 | |
| 207 | void RewriteDictNode(JSONValue& node, JSONDocument::AllocatorType& allocator, |
| 208 | const char* target_type) { |
no test coverage detected