Skip to content

fix: fallback to shared_data_dir when loading ReverseDb - #430

Merged
hchunhui merged 1 commit into
hchunhui:masterfrom
DeepChirp:fix/reversedb-shared-data-fallback
Apr 26, 2026
Merged

hchunhui merged 1 commit into
hchunhui:masterfrom
DeepChirp:fix/reversedb-shared-data-fallback

Conversation

@DeepChirp

@DeepChirp DeepChirp commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Problem

ReverseDb only searches user_data_dir, but some packaged deployments place read-only db files in shared_data_dir.

A concrete example is iDvel/rime-ice#1526, which rewrote lunar.lua to use ReverseDb("lua/lunar.db"). On Arch Linux, that db is packaged at /usr/share/rime-data/lua/lunar.db (see rime-ice-git package on AUR). As a result, the file is not found and the lunar feature does not work.

Change

When loading ReverseDb, keep user_data_dir as the first choice. If the target file does not exist, fall back to shared_data_dir.

Apply the same logic to both COMPAT branches.

ReverseDb previously only looked up files from user_data_dir.
This breaks deployments where read-only data files are installed
under shared_data_dir, such as packaged environments.

Try user_data_dir first and fall back to shared_data_dir when the
target file does not exist. Keep user overrides intact by preserving
the existing precedence.

Apply the same behavior to both legacy and newer COMPAT branches.

Signed-off-by: DeepChirp <DeepChirp@outlook.com>
@hchunhui
hchunhui merged commit ef17b1f into hchunhui:master Apr 26, 2026
6 checks passed
@hchunhui

Copy link
Copy Markdown
Owner

Thanks!

@DeepChirp
DeepChirp deleted the fix/reversedb-shared-data-fallback branch April 26, 2026 05:11
sabertaz added a commit to sabertaz/dotfiles that referenced this pull request Jun 19, 2026
PR hchunhui/librime-lua#430 makes ReverseDb fall back to shared_data_dir,
so librime-lua now finds /usr/share/rime-data/lua/lunar.db directly.
Remove the symlink workaround (427d98c) and its verify-script check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants