Repository navigation
v1.2.0 — 三平台 Obsidian 查找 + 系统声明
v1.2.0 — Obsidian 在 macOS / Linux 上也能被找到,系统声明补齐
之前 package.json 里没法诚实写 os: [win32, darwin, linux]:Obsidian 的可执行文件只在 Windows 路径里找,知识库注册表只读 %APPDATA%,obsidian:// 回退也总是 cmd.exe —— 在 macOS/Linux 上只能用 DSH_OBSIDIAN_APP 手动指路。现在三平台都通了。
按平台查找(DSH_OBSIDIAN_APP 永远排第一)
| 平台 | 候选路径 |
|---|---|
| Windows | %LOCALAPPDATA%\Obsidian、%LOCALAPPDATA%\Programs\Obsidian、Program Files、Program Files (x86) |
| macOS | /Applications/Obsidian.app/Contents/MacOS/Obsidian、~/Applications/... |
| Linux | ~/.local/bin 与 ~/Applications 的 AppImage、/usr/bin、/usr/local/bin、/snap/bin、系统与用户级 flatpak |
知识库注册表也按平台读取:%APPDATA% / ~/Library/Application Support / $XDG_CONFIG_HOME(默认 ~/.config)。打开笔记的回退处理器按平台选择:start / open / xdg-open。
路径拼接跟随目标平台的分隔符而不是宿主 —— 这正是能让三份清单在同一台机器上被断言的原因。
可验证
test/platform-check.mjs(新增,22 项断言,已进 CI):三个平台的候选清单与注册表路径,含退化情形(空环境、没有 home)。test/manifest-check.mjs扩到 24 项:os必须声明且只能是审核认识的系统。index.mjs导出__internals供断言,与客户端半的exports.__internals一致。- CI run #9 全绿(新增 “Platform paths” 步骤)。
一点如实的说明
目前只在 Windows 上实跑过。macOS/Linux 的清单是被断言过的,还没有对着那两个系统上真实的 Obsidian 运行过 —— README 里就是这么写的,没有假装碰过没碰过的硬件。
English
v1.2.0 makes Obsidian discovery cross-platform, which is what lets the manifest declare
os: [win32, darwin, linux] honestly. candidateApps / configPath are now per-platform
pure functions of (platform, env, home) — /Applications and ~/Applications on macOS,
AppImage//usr/bin//usr/local/bin/snap/flatpak on Linux, the usual installs on Windows,
with DSH_OBSIDIAN_APP first everywhere — and path joining follows the target platform, so
test/platform-check.mjs (22 checks, in CI) asserts all three lists from any machine. The
obsidian:// fallback picks start / open / xdg-open. manifest-check now pins the
declared systems (24 checks). Run on Windows so far; the macOS/Linux lists are asserted, not
yet exercised against a real Obsidian, and the README says so.