Skip to content

fix: correct input method installation path in SquirrelApp.appDir - #1161

Open
Wujidadi wants to merge 1 commit into
rime:masterfrom
Wujidadi:fix/input-source-registration-path
Open

fix: correct input method installation path in SquirrelApp.appDir#1161
Wujidadi wants to merge 1 commit into
rime:masterfrom
Wujidadi:fix/input-source-registration-path

Conversation

@Wujidadi

Copy link
Copy Markdown
Contributor

Problem

SquirrelApp.appDir in sources/Main.swift has read /Library/Input Library/Squirrel.app since the Swift migration (ce4f761, #898):

static let appDir = "/Library/Input Library/Squirrel.app".withCString { dir in

The standard input method location is /Library/Input Methods/Squirrel.app, which is also where the Makefile and the installer actually place the app. As a result, TISRegisterInputSource(SquirrelApp.appDir) in --register-input-source points at a nonexistent path, so explicit (re-)registration has been silently broken for every Swift-era release.

Why it went unnoticed

  • On systems where Squirrel is already enabled, SquirrelInstaller.register() returns early before ever calling TISRegisterInputSource.
  • On fresh systems, macOS auto-discovers input methods placed under /Library/Input Methods, so installation still appears to work without explicit registration.

The breakage only shows when re-registration actually matters, e.g. re-registering after the app bundle has been replaced by a from-source reinstall.

Fix

Correct the path to /Library/Input Methods/Squirrel.app.

- SquirrelApp.appDir has read "/Library/Input Library/Squirrel.app" since the Swift migration (ce4f761); the standard location is "/Library/Input Methods/Squirrel.app"
- TISRegisterInputSource(appDir) in --register-input-source therefore points at a nonexistent path, so explicit re-registration has been silently broken
- The bug went unnoticed because already-enabled installations return early in register(), and on fresh systems macOS auto-discovers apps under /Library/Input Methods without explicit registration
Copilot AI review requested due to automatic review settings July 25, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a long-standing bug in the Swift-era implementation of SquirrelApp.appDir by correcting the hardcoded input method installation path so that explicit input-source registration targets the actual on-disk location under /Library/Input Methods.

Changes:

  • Update SquirrelApp.appDir from /Library/Input Library/Squirrel.app to /Library/Input Methods/Squirrel.app to match the standard macOS input method install location and the project’s installer/Makefile behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Wujidadi added a commit to Wujidadi/squirrel that referenced this pull request Jul 25, 2026
- 自 PR rime#1161 分支 cherry-pick(874123c)
- appDir 自 Swift 移轉(ce4f761)起誤植為 /Library/Input Library/Squirrel.app,致 --register-input-source 的 TISRegisterInputSource 指向不存在的路徑,顯式重新註冊靜默失效
- 修正為標準路徑 /Library/Input Methods/Squirrel.app,bundle 更換後的重新註冊自此真正可用
@lotem

lotem commented Jul 27, 2026

Copy link
Copy Markdown
Member

Good catch!

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.

3 participants