我正在通过文件系统事件观察文件路径以进行更改。现在我需要知道是否可以获得对位置无关的文件的引用,以便在移动文件时跟踪文件。
I'm observing a file path for changes via file system events. Now I need to know if it is possible to get a reference to a file that is location independent, to keep track of the file when it is moved.
这是使用OSX API完成?
Is this be accomplished with OSX APIs?
推荐答案您可以通过获取文件的别名引用来实现。这需要使用Carbon API,但有一个很好的Objective-C包装器叫做NDAlias,我过去使用过: https: //github/nathanday/ndalias 。
You can do this by getting an alias reference to the file. This requires using Carbon API, but there's a nice Objective-C wrapper called NDAlias that I've used in the past: github/nathanday/ndalias .
请参阅这里获取更多文档: developer.apple/library/mac/#documentation/Carbon/Reference/Alias_Manager/Reference/ reference.html
See here for more documentation: developer.apple/library/mac/#documentation/Carbon/Reference/Alias_Manager/Reference/reference.html
更多推荐
移动后找到文件
发布评论