Conversation
On Termux — the dominant Node runtime that reports process.platform 'android' — both external-open actions fell through to xdg-open, which does not exist there, so 'reveal in file manager' and custom-scheme URL opens failed silently (the spawn error is swallowed by design). - revealCommand: case 'android' → termux-open on the containing directory (no desktop file manager and no select protocol on Android; same parent-dir KISS as the Linux branch) - urlCommand: case 'android' → termux-open-url (the URL intent dispatcher; termux-open would route URLs through the content chooser) Command builders stay pure — the platform remains injectable and the new branches are unit-tested like every other platform.
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.
问题
在 Termux(Android 上最主要的 Node 运行时,
process.platform为'android')上,文件树右键「在资源管理器中显示」和自定义 URL scheme 打开静默失败:两个 command builder 都落到 default 分支调用xdg-open,而 Termux 里根本没有这个命令(spawn 错误按设计吞掉,用户侧表现为点了没反应)。修复
按文件既有的纯函数 + 平台可注入风格,各加一个
case 'android':revealCommand:termux-open打开父目录——Android 没有桌面文件管理器也没有 select 协议,与 Linux 分支同样走父目录的 KISS 路线,交给 Android 系统的打开方式选择器;urlCommand:termux-open-url分发 URL intent(termux-open会先把 URL 路由到内容选择器,URL 专用入口更直接)。验证
tsc --noEmit通过tests/open-external.spec.ts新增 3 个 android 用例,13/13 通过(真机 Termux 环境实测运行)TERMUX_VERSION=0.118,/data/data/com.termux/files/usr/bin/termux-open{,-url}存在)上确认两个命令可用