|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index 8336d50..ca40c0d 100644 |
| 3 | +--- a/CMakeLists.txt |
| 4 | ++++ b/CMakeLists.txt |
| 5 | +@@ -37,9 +37,7 @@ include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cma |
| 6 | + |
| 7 | + add_subdirectory(po) |
| 8 | + add_subdirectory(src) |
| 9 | +-add_subdirectory(data) |
| 10 | + enable_testing() |
| 11 | +-add_subdirectory(test) |
| 12 | + |
| 13 | + fcitx5_translate_desktop_file(org.fcitx.Fcitx5.Addon.Zhuyin.metainfo.xml.in |
| 14 | + org.fcitx.Fcitx5.Addon.Zhuyin.metainfo.xml XML) |
| 15 | +diff --git a/src/zhuyinengine.cpp b/src/zhuyinengine.cpp |
| 16 | +index c886797..d0e220c 100644 |
| 17 | +--- a/src/zhuyinengine.cpp |
| 18 | ++++ b/src/zhuyinengine.cpp |
| 19 | +@@ -306,17 +306,17 @@ ZhuyinEngine::ZhuyinEngine(Instance *instance) |
| 20 | + : instance_(instance), factory_([this](InputContext &ic) { |
| 21 | + return new ZhuyinState(this, &ic); |
| 22 | + }) { |
| 23 | +- auto userDir = |
| 24 | +- StandardPaths::global().userDirectory(StandardPathsType::PkgData) / |
| 25 | +- "zhuyin"; |
| 26 | ++ const auto &sp = StandardPaths::global(); |
| 27 | ++ auto userDir = sp.userDirectory(StandardPathsType::PkgData) / "zhuyin"; |
| 28 | + if (!fs::makePath(userDir)) { |
| 29 | + if (fs::isdir(userDir)) { |
| 30 | + ZHUYIN_DEBUG() << "Failed to create user directory: " << userDir; |
| 31 | + } |
| 32 | + } |
| 33 | +- context_.reset(zhuyin_init( |
| 34 | +- StandardPaths::fcitxPath("pkgdatadir", "zhuyin").string().c_str(), |
| 35 | +- userDir.string().c_str())); |
| 36 | ++ std::string tablePath = |
| 37 | ++ sp.locate(StandardPathsType::PkgData, "zhuyin/table.conf"); |
| 38 | ++ context_.reset(zhuyin_init(fcitx::fs::dirName(tablePath).c_str(), |
| 39 | ++ userDir.string().c_str())); |
| 40 | + |
| 41 | + instance->inputContextManager().registerProperty("zhuyinState", &factory_); |
| 42 | + reloadConfig(); |
| 43 | +@@ -553,11 +553,6 @@ void ZhuyinEngine::reloadConfig() { |
| 44 | + |
| 45 | + zhuyin_set_options(context_.get(), options); |
| 46 | + |
| 47 | +- instance_->inputContextManager().foreach([this](InputContext *ic) { |
| 48 | +- auto *state = ic->propertyFor(&factory_); |
| 49 | +- state->reset(); |
| 50 | +- return true; |
| 51 | +- }); |
| 52 | + |
| 53 | + zhuyin_load_phrase_library(context_.get(), USER_DICTIONARY); |
| 54 | + } |
0 commit comments