| 465 | } |
| 466 | |
| 467 | void HunspellInterface::set_directory(const wchar_t *dir) { |
| 468 | if (dir == nullptr || *dir == L'\0') |
| 469 | return; |
| 470 | |
| 471 | m_user_dic_path = dir; |
| 472 | if (m_user_dic_path.back() != L'\\') |
| 473 | m_user_dic_path += L"\\"; |
| 474 | m_user_dic_path += L"UserDic.dic"; // Should be tunable really |
| 475 | m_dic_dir = dir; |
| 476 | |
| 477 | m_dic_list.clear(); |
| 478 | m_is_hunspell_working = true; |
| 479 | |
| 480 | auto files = list_files(dir, L"*.*", L"*.aff"); |
| 481 | if (files.empty()) { |
| 482 | return; |
| 483 | } |
| 484 | |
| 485 | for (auto &file_path : files) { |
| 486 | auto dic_file_path = file_path.substr(0, file_path.length() - 4) + L".dic"; |
| 487 | if (PathFileExists(dic_file_path.c_str())) { |
| 488 | auto dic_name = file_path.substr(dic_file_path.rfind(L'\\') + 1); |
| 489 | dic_name = dic_name.substr(0, dic_name.length() - 4); |
| 490 | AvailableLangInfo new_x; |
| 491 | new_x.type = 0; |
| 492 | new_x.name = dic_name; |
| 493 | new_x.full_path = file_path.substr(0, file_path.length() - 4); |
| 494 | m_dic_list.insert(new_x); |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | void HunspellInterface::set_additional_directory(const wchar_t *dir) { |
| 500 | m_sys_dic_dir = dir; |
no test coverage detected