You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Словари не находятся при сборке на новом Swift (6.4): .bin кладутся в корень бандла, а не в Contents/Resources #14
Со свежим Swift scripts/build-app.sh копирует скомпилированные словари *.bin в кореньSwitchFix_Dictionary.bundle. Но SwiftPM теперь собирает бандл по макОС-схеме (Contents/Resources/), а Bundle.url(forResource:) ищет только в Contents/Resources. В итоге ни один словарь не находится, и ничего не исправляется ни в автоматическом режиме, ни по хоткею.
Окружение
SwitchFix v0.0.9 (d31f7b6), собран из исходников через ./install.sh
macOS 27.0, Apple Silicon (arm64)
Xcode 27.0, Apple Swift 6.4 (swiftlang-6.4.0.34.1)
Симптомы
Приложение запускается, event tap активен, хоткей ловится, но исправлений нет. Лог:
[com.switchfix:dictionary] [SwitchFix] missing or invalid binary resource for ru_RU
[com.switchfix:dictionary] [SwitchFix] ru_RU unavailable; automatic correction target disabled
[com.switchfix:dictionary] [SwitchFix] missing or invalid binary resource for en_US
[com.switchfix:detector] [SwitchFix] detect 'ghbdtn' -> keep (no correction, ms=0.254042)
Что получается внутри бандла:
SwitchFix_Dictionary.bundle/
├── en_US.bin <- сюда их кладёт build-app.sh
├── ru_RU.bin
├── uk_UA.bin
└── Contents/
├── Info.plist
└── Resources/ <- а Bundle.url(forResource:) ищет здесь
├── en_US.txt <- и текстовые фолбэки тоже не удаляются
├── ru_RU.txt
├── uk_UA.txt
└── overrides/
Исправление
Если у бандла есть Contents/Resources, класть бинарники туда. Для старых тулчейнов плоская структура остаётся рабочей:
DICT_BUNDLE="$APP_BUNDLE/Contents/Resources/SwitchFix_Dictionary.bundle"
+ # Newer Swift toolchains emit a macOS-style bundle (Contents/Resources);+ # Bundle.url(forResource:) only looks there, not at the bundle root.+ if [ -d "$DICT_BUNDLE/Contents/Resources" ]; then+ DICT_BUNDLE="$DICT_BUNDLE/Contents/Resources"+ fi
for lang in en_US ru_RU uk_UA; do
После правки в логе появляется loaded ru_RU (entries: 146229, bloom: yes), и исправления работают. Заодно строка rm -f "$DICT_BUNDLE/${lang}.txt" начинает удалять текстовые фолбэки там, где они реально лежат.
Возможно, связано с #1 и #5: там тоже был путь к бандлу словарей.
Pre-merge audit against released v0.0.11 and PR #22 (commit 68873cc): still unresolved. No verified fixed version yet.
In both revisions, scripts/build-app.sh copies compiled dictionaries into the root of SwitchFix_Dictionary.bundle and removes text fallbacks from that same root. It does not select Contents/Resources when SwiftPM emits a macOS-style bundle.
Proposed fix:
After copying the bundle, use its Contents/Resources directory when present; otherwise retain the flat-bundle path.
Copy all three .bin files and remove their .txt fallbacks in that selected resource directory.
Exercise both bundle layouts with a small shell regression check, then build with Swift 6.4 and verify Foundation resource lookup and dictionary loading from the packaged app.
Leaving open until the packaging fix is verified and shipped.
Activity
Hantok commentedon Oct 20, 2026
Pre-merge audit against released v0.0.11 and PR #22 (commit 68873cc): still unresolved. No verified fixed version yet.
In both revisions,
scripts/build-app.shcopies compiled dictionaries into the root ofSwitchFix_Dictionary.bundleand removes text fallbacks from that same root. It does not selectContents/Resourceswhen SwiftPM emits a macOS-style bundle.Proposed fix:
Contents/Resourcesdirectory when present; otherwise retain the flat-bundle path.Leaving open until the packaging fix is verified and shipped.
spike: probe whether macOS installs spelling data for enabled layouts