如何以编程方式触发 Finder 的移动文件对话框?
我正在开发一个小型 Cocoa 实用程序,它允许用户将文件拖到其窗口上,然后将它们移动到不同的文件夹。
我不想自己移动拖动的文件(通过 [[NSWorkspace sharedWorkspace] PerformFileOperation:NSWorkspaceMoveOperation...]
),我想触发 Finder 的“移动文件对话框”。这将为用户提供视觉反馈(进度条)并负责错误处理(例如目标文件存在)。
我考虑过使用 Apple 脚本,但也许有更简单的方法来调出该对话框?
I'm working on a small Cocoa utility that lets the user drag files onto its window and then moves those to a different folder.
Instead of moving the dragged file myself (via [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceMoveOperation...]
), I would like to trigger Finder's "Move File Dialog". This will give the user visual feedback (progress bar) and take care of error handling (e.g. file at target exists).
I've thought about using an Apple Script, but maybe there's an easier way to bring up that dialog?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许你应该检查 NSFileManager。
http://开发人员。 apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
Maybe you should check the NSFileManager.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html