| 119 | } |
| 120 | |
| 121 | std::vector<std::string> SplitSearchPath(const char* raw) { |
| 122 | std::vector<std::string> entries; |
| 123 | if (raw == nullptr || *raw == '\0') { |
| 124 | return entries; |
| 125 | } |
| 126 | const char separator = |
| 127 | #if defined(_WIN32) || defined(_WIN64) |
| 128 | ';'; |
| 129 | #else |
| 130 | ':'; |
| 131 | #endif |
| 132 | std::string path(raw); |
| 133 | std::string::size_type start = 0; |
| 134 | while (start <= path.size()) { |
| 135 | const std::string::size_type end = path.find(separator, start); |
| 136 | const std::string entry = path.substr(start, end - start); |
| 137 | if (!entry.empty()) { |
| 138 | entries.push_back(entry); |
| 139 | } |
| 140 | if (end == std::string::npos) { |
| 141 | break; |
| 142 | } |
| 143 | start = end + 1; |
| 144 | } |
| 145 | return entries; |
| 146 | } |
| 147 | |
| 148 | void SetError(opencc_error_t* error, |
| 149 | int code, |