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

Method set_additional_directory

src/spellers/HunspellInterface.cpp:499–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499void HunspellInterface::set_additional_directory(const wchar_t *dir) {
500 m_sys_dic_dir = dir;
501 m_is_hunspell_working = true;
502
503 auto files = list_files(dir, L"*.*", L"*.aff");
504 if (files.empty())
505 return;
506
507 for (auto &file : files) {
508 auto file_name_without_ext = file.substr(0, file.rfind(L'.'));
509 if (PathFileExists((file_name_without_ext + L".dic").c_str())) {
510 AvailableLangInfo new_x;
511 new_x.type = 1;
512 new_x.name = file_name_without_ext.substr(file_name_without_ext.rfind(L'\\') + 1);
513 new_x.full_path = file.substr(0, file.length() - 4);
514 if (m_dic_list.count(new_x) == 0)
515 m_dic_list.insert(new_x);
516 }
517 }
518 // Now we have 2 dictionaries on our hands
519
520 // Reading system path unified dic too
521 m_system_wrong_dic_path = dir;
522 if (m_system_wrong_dic_path.back() != L'\\')
523 m_system_wrong_dic_path += L"\\";
524 m_system_wrong_dic_path += L"UserDic.dic"; // Should be tunable really
525}
526
527bool HunspellInterface::get_lang_only_system(const wchar_t *lang) const {
528 AvailableLangInfo needle;

Callers 1

Calls 5

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

Tested by

no test coverage detected