MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / set_directory

Method set_directory

src/spellers/HunspellInterface.cpp:467–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467void 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
499void HunspellInterface::set_additional_directory(const wchar_t *dir) {
500 m_sys_dic_dir = dir;

Callers 1

Calls 5

list_filesFunction · 0.85
clearMethod · 0.80
substrMethod · 0.80
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected