| 309 | |
| 310 | template<typename T> |
| 311 | static void Parse(const wchar_t *file, T* dst) |
| 312 | { |
| 313 | FILE *fp; |
| 314 | wchar_t path[MAX_PATH]; |
| 315 | wcscpy(path, file); |
| 316 | |
| 317 | fp = _wfopen(path, L"r"); |
| 318 | |
| 319 | if (!fp) { |
| 320 | GetModuleFileName(NULL, path, MAX_PATH); |
| 321 | PathRemoveFileSpec(path); |
| 322 | |
| 323 | do |
| 324 | { |
| 325 | PathAppend(path, file); |
| 326 | fp = _wfopen(path, L"r"); |
| 327 | } |
| 328 | while (!fp && PathRemoveFileSpec(path) && PathRemoveFileSpec(path)); |
| 329 | } |
| 330 | |
| 331 | if (!fp) |
| 332 | return; |
| 333 | |
| 334 | wchar_t line[4096]; |
| 335 | while(fgetws(line, 4096, fp)) |
| 336 | { |
| 337 | wchar_t *start = line; |
| 338 | while(*start && isspace(*start)) |
| 339 | start++; |
| 340 | |
| 341 | if (*start == 0) |
| 342 | continue; |
| 343 | |
| 344 | wchar_t *end = line+wcslen(line)-1; |
| 345 | while(end != start && isspace(*end)) |
| 346 | *end-- = 0; |
| 347 | |
| 348 | dst->Add(start); |
| 349 | } |
| 350 | fclose(fp); |
| 351 | } |
| 352 | |
| 353 | StringSet::StringSet(const wchar_t *file, bool caseCheck) |
| 354 | { |
no test coverage detected