Commit Graph
3 Commits
Author SHA1 Message Date
yuanyuanxiangandClaude Code 28c0c9a2a6 Feature: add file management to the Android client
Android 客户端此前没有文件管理:声明了 CLIENT_CAP_V2 却没有实现,主控的
文件管理对话框和 MCP 的 list_files/download_file/upload_file 对 APK 只会
超时。本次复用 Linux/macOS 已在用的 common/FileManager.h,只补平台差异:

- 盘符模型:P=应用私有目录、I=内部存储、S/T/...=SD 卡与 U 盘;V2 上传
  通过 FileTransferV2::SetPathMapper 复用同一套映射。
- 文件通道线上是 GBK。NDK 的 iconv 要 API 28,客户端 minSdk 是 21,改走
  JNI -> Java Charset(NativeText.kt),严格模式失败原样透传。
- Android 11+ 引导开启「所有文件访问」;未授权时只挂 P: 并回一条提示。
  API <=29 用运行时存储权限 + requestLegacyExternalStorage。
- 顺带实现 COMMAND_SEARCH_FILE(深度 32、1 万条),并让 MCP 的
  list_files/download_file/upload_file/read_file 对 APK 开闸。

验证:arm64/armeabi 与模拟器 ABI 编译通过;模拟器上用 MCP 完成列盘、
列目录、下载、上传、中文文件名往返,GUI 文件管理器正常显示 P:/I:/S:。

Model: deepseek-flash
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-16 18:34:46 +01:00
yuanyuanxianganddeepseek-flash 106ac2ff0f Fix: Resolve the Desktop, Downloads and home shortcuts on Unix clients
The file manager's remote shortcut buttons send "%USERPROFILE%\Desktop\" and
friends, which the Windows client expands with ExpandEnvironmentStringsA. Unix
clients had no such expansion, so the literal %USERPROFILE% was taken as a
directory name: opendir() failed and the Desktop, Downloads and home buttons
listed nothing at all.

Add common/UnixPath.h, which expands the variables the server can send
(%USERPROFILE%, %HOME%, %HOMEDRIVE%%HOMEPATH%, %USERNAME%) and maps
$HOME/Desktop to the localized folder named in ~/.config/user-dirs.dirs (for
example ~/桌面), falling back to the plain $HOME/<Name> path when that folder
does not exist. Unknown %VAR% tokens are left untouched, so paths that really
contain a percent sign behave as before.

FileManager and the two Windows-to-Unix converters in FileTransferV2 now share
that one conversion. Besides the listing itself, this fixes downloads into a
shortcut directory, which used to be created under a literal %USERPROFILE%
tree instead of the user's real desktop.

Co-Authored-By: deepseek-flash
2026-10-28 14:44:54 +01:00
yuanyuanxiang 36423b1c7c Refactor: Move FileManager to common, add macOS file management support 2026-05-03 10:30:30 +02:00