Skip to content

Commit 681bacf

Browse files
authored
fix checking a possibly non-existing directory causing a crash when compiled with --local
1 parent 0c4562e commit 681bacf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/mecab_split.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ auto find_file_recursive(
7373
) -> std::filesystem::path
7474
{
7575
for (size_t idx = 0; idx < possible_dirs.size(); ++idx) {
76+
if (!std::filesystem::is_directory(possible_dirs[idx])) {
77+
continue;
78+
}
7679
for (auto const& dir_entry: std::filesystem::directory_iterator(possible_dirs.at(idx))) {
7780
if (dir_entry.is_regular_file() and dir_entry.path().filename() == file_name) {
7881
return dir_entry.path();
@@ -99,6 +102,7 @@ auto find_dic_dir() -> std::filesystem::path
99102
static std::vector<std::filesystem::path> const possible_dirs = {
100103
"/usr/lib/mecab/dic/mecab-ipadic-neologd", // neologd is preferred if available
101104
"/usr/lib/mecab/dic",
105+
"/usr/lib64/mecab/dic",
102106
user_home() / ".local/share/Anki2/addons21",
103107
};
104108
// parent path of an empty entry returns itself.

0 commit comments

Comments
 (0)