fix(windows): align StandardPaths with GNUInstallDirs and honor FCITX_DATA_DIRS#1544
Open
gaboolic wants to merge 4 commits intofcitx:masterfrom
Open
fix(windows): align StandardPaths with GNUInstallDirs and honor FCITX_DATA_DIRS#1544gaboolic wants to merge 4 commits intofcitx:masterfrom
gaboolic wants to merge 4 commits intofcitx:masterfrom
Conversation
- Map builtin dirs to share/fcitx5 and share/locale (GNUInstallDirs layout). - Honor FCITX_DATA_DIRS (semicolon-separated) when resolving fcitx5 pkg data. - Add EventDispatcher::dispatchPending() for same-thread deferred work (TSF). Made-with: Cursor
fix(windows): align StandardPaths with GNUInstallDirs and honor FCITX_DATA_DIRS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Align the built-in paths on Windows with the actual installation tree and complete the FCITX_DATA_DIRS to match the behavior of Linux and meet the requirements of portability/TSF integration; failure to complete any of these steps will result in incorrect directory search or ignore the data path injected at startup during actual deployment.
If it is not changed to "share/", in the scenario of "portable directory / installation tree with the same prefix as binary", the theme, locale, pkgdata, etc. will point to non-existent directories, resulting in resource loading failures. Therefore, the datadir / pkgdatadir / localedir of the built-in must be aligned with the actual installation layout. This is not a style issue but a path semantic error.
On Unix, FCITX_DATA_DIRS is already involved in the PkgData search for fcitx5 (see standardpaths_p_unix.cpp / standardpath.cpp).
Windows follows an independent standardpaths_p_win.cpp. If this variable is not read, it will be inconsistent with Unix, and downstream cannot inject additional data roots.
fcitx5-windows and others will set FCITX_DATA_DIRS when starting up (data directories under the portable package and the prefix of the IME side injection installation). It is not parsed on the Win side, and these settings are invalid for PkgData, causing the portable/custom layout to break. The separator used is ;, which is consistent with the common writing style of multiple paths in Windows environment variables.
让 Windows 上的 内置路径与真实安装树一致,并 补齐 FCITX_DATA_DIRS,从而与 Linux 行为对齐且满足便携/TSF 集成;缺任一环节都会在真实部署中找错目录或忽略启动时注入的数据路径。
master 里 standardpaths_p_win.cpp 把「可执行文件旁的内置树」写成 ../data、../data/fcitx5、../data/locale。
fcitx5 在 Windows / 交叉编译下实际安装的是 share/、share/fcitx5、share/locale(与 GNUInstallDirs 一致),不是单独的 data/ 前缀。
若不改成 share/,在「便携目录 / 与 binary 同前缀的安装树」场景下,主题、locale、pkgdata 等会指向不存在的目录,表现为资源加载失败。因此 builtin 的 datadir / pkgdatadir / localedir 必须与真实安装布局对齐,这不是风格问题,是路径语义错误。
在 Unix 上,FCITX_DATA_DIRS 已参与 fcitx5 的 PkgData 搜索(见 standardpaths_p_unix.cpp / standardpath.cpp)。
Windows 走独立的 standardpaths_p_win.cpp,若不读该变量,则与 Unix 不一致,且下游无法注入额外数据根。
fcitx5-windows 等在启动时会设置 FCITX_DATA_DIRS(便携包、IME 侧注入安装前缀下的数据目录)。不在 Win 侧解析它,这些设置对 PkgData 无效,便携/定制布局会断。分隔符使用 ;,与 Windows 环境变量里多路径的常见写法一致。
teststandardpaths_win.cpp 里对「内置 PkgData 最后一项」的断言必须与上述 share/fcitx5 一致,否则 CI 会误报失败;该修改是前两点的直接结果,而非可有可无的测试 tweak。