Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/skk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,20 @@ void SkkEngine::loadDictionary() {
if (path.empty() || mode == 0) {
continue;
}

std::string_view partialpath = path;
if (stringutils::consumePrefix(partialpath,
"$FCITX_CONFIG_DIR/")) {
path = StandardPaths::global().userDirectory(
StandardPathsType::PkgData) /
partialpath;
} else if (stringutils::consumePrefix(partialpath,
"$XDG_DATA_DIRS/")) {
path = StandardPaths::global().locate(
StandardPathsType::Data, partialpath);
}

if (mode == 1) {
std::string_view partialpath = path;
if (stringutils::consumePrefix(partialpath,
"$XDG_DATA_DIRS/")) {
path = StandardPaths::global().locate(
StandardPathsType::Data, partialpath);
}
if (stringutils::endsWith(path, ".cdb")) {
SkkCdbDict *dict =
skk_cdb_dict_new(path.data(), encoding.data(), nullptr);
Expand All @@ -557,13 +564,6 @@ void SkkEngine::loadDictionary() {
}
}
} else {
std::string_view partialpath = path;
if (stringutils::consumePrefix(partialpath,
"$FCITX_CONFIG_DIR/")) {
path = StandardPaths::global().userDirectory(
StandardPathsType::PkgData) /
partialpath;
}
SkkUserDict *userdict =
skk_user_dict_new(path.data(), encoding.data(), nullptr);
if (userdict) {
Expand Down