您应该如何打开外部编辑器并监视文件/应用程序的更改?

发布于 2024-12-15 04:59:04 字数 314 浏览 3 评论 0 原文

某些应用程序(尤其是文件传输应用程序)允许您生成外部文本编辑器以编辑远程文件。他们通过将文件下载到临时目录,使用该文件打开外部编辑器,然后监视文件和/或应用程序状态的更改(例如,当它退出时)并使用这些作为触发器来上传修改后的文件来实现此目的到远程服务器。

我想实现类似的功能(特别是使用 AppleScript 编辑器,尽管我想了解一般情况) - 在 Objective-C/Cocoa 中这样做的好方法是什么?

我应该避免哪些潜在的陷阱?我想中途进行保存会导致一些问题......?

我通过 iOS 编程熟悉了 Objective-C,但刚刚开始接触 Cocoa。

Some applications (especially file transfer apps) allow you to spawn an external text editor in order to edit a remote file. They do this by downloading the file to a temporary directory, opening the external editor with this file, and then monitoring for changes to the file and/or the application state (e.g. when it quits) and use these as triggers to upload the modified file to the remote server.

I would like to implement similar functionality (specifically using AppleScript Editor, though I would like to understand the general case) - what is a good way to go about doing so in Objective-C/Cocoa?

What are some of the potential pitfalls I should avoid? I imagine catching a save halfway through would cause some issues...?

I'm familiar with Objective-C through iOS programming, but have only just started with Cocoa.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文