惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
G
Google Developers Blog
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
爱范儿
爱范儿
B
Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
博客园_首页
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Why NSOpenPanel Can't See Your Android Device
hiyoyo · 2026-06-01 · via DEV Community
Cover image for Why NSOpenPanel Can't See Your Android Device

hiyoyo

All tests run on an 8-year-old MacBook Air.

When I was building HiyokoMTP, I hit a limitation that seems obvious in hindsight: you can't use a native macOS folder picker to browse an Android device over MTP.

NSOpenPanel — the standard macOS file dialog — has no idea your Android device exists. It only sees what Finder mounts, and Finder doesn't mount MTP devices as a proper volume. So the entire native folder selection API is useless for this use case.


Why the Native Dialog Can't See Your Android Device

macOS exposes the file system to apps through a set of APIs that assume storage is mounted as a volume. MTP doesn't work that way. It's a stateful protocol layered over USB — not a file system mount.

Android File Transfer used to create a virtual mount, but that approach had reliability issues and kernel extension dependencies, and is largely abandoned. Modern MTP implementations talk to the device directly over USB and manage the object tree themselves. The OS never sees it as a folder.

The result: NSOpenPanel, NSSavePanel, Finder integration — none of it works for MTP paths. You're on your own.


How to Build One Anyway

If you need folder selection over MTP, you have to build your own picker from scratch. Here's the approach:

Rust side — expose a list_mtp_dir(path) command via Tauri IPC. This queries the MTP device for the contents of a given directory and returns the object list.

#[tauri::command]
fn list_mtp_dir(path: String) -> Result<Vec<MtpObject>, String> {
    // query MTP device and return object list
}

React side — build a modal UI that behaves like a minimal Finder:

// On open
const root = await invoke("list_mtp_dir", { path: "/" });
// On folder selection
const contents = await invoke("list_mtp_dir", { path: selectedPath });
// Maintain a navigation stack to support back navigation
const [navStack, setNavStack] = useState<string[]>(["/"]);

It's straightforward in principle — it's just more work than you'd expect, because the OS would normally handle all of this for you.


Current State in HiyokoMTP

Worth noting upfront: this isn't implemented yet in the current version. For now, folder paths are entered manually or via preset. A proper MTP folder picker is planned for v2.

If you're building your own MTP client and need this, the architecture above is the approach to take — there's no shortcut through native APIs.


One-time purchase, no subscription.

https://hiyokomtp.lemonsqueezy.com/checkout/buy/2e966b64-554e-42a0-b865-4240281978a1

Have you run into other macOS APIs that silently break over MTP?