| 81 | } |
| 82 | |
| 83 | void HunspellSpellChecker::ReadUserDictionary() { |
| 84 | customWords.clear(); |
| 85 | |
| 86 | // Read the old contents of the user's dictionary |
| 87 | try { |
| 88 | auto stream = agi::io::Open(userDicPath); |
| 89 | copy_if( |
| 90 | ++agi::line_iterator<std::string>(*stream), agi::line_iterator<std::string>(), |
| 91 | inserter(customWords, customWords.end()), |
| 92 | [](auto const& str) { return !str.empty(); }); |
| 93 | } |
| 94 | catch (agi::fs::FileNotFound const&) { |
| 95 | // Not an error; user dictionary just doesn't exist |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | void HunspellSpellChecker::WriteUserDictionary() { |
| 100 | // Ensure that the path exists |