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

Function SplitSearchPath

src/PluginSegmentation.cpp:97–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97std::vector<std::string> SplitSearchPath(const char* raw) {
98 std::vector<std::string> entries;
99 if (raw == nullptr || *raw == '\0') {
100 return entries;
101 }
102 const char separator =
103#if defined(_WIN32) || defined(_WIN64)
104 ';';
105#else
106 ':';
107#endif
108 std::string path(raw);
109 std::string::size_type start = 0;
110 while (start <= path.size()) {
111 const std::string::size_type end = path.find(separator, start);
112 const std::string entry = path.substr(start, end - start);
113 if (!entry.empty()) {
114 entries.push_back(entry);
115 }
116 if (end == std::string::npos) {
117 break;
118 }
119 start = end + 1;
120 }
121 return entries;
122}
123
124#if defined(_WIN32) || defined(_WIN64)
125using internal::Utf8FromWide;

Callers 1

BuildSearchDirsMethod · 0.70

Calls 5

findMethod · 0.80
sizeMethod · 0.45
substrMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected