在 Spotlight 导入器之外修改文件的 Spotlight 元数据?

发布于 2024-07-06 17:13:02 字数 468 浏览 9 评论 0原文

我想修改我的应用程序中文件的 Spotlight 元数据属性(即不在 Spotlight 导入器中),但我找不到任何 API 可以执行此操作。 是否可以? 指向相关文档的指针将是理想的选择。

如果它有帮助,这是我的用例:

我想存储对文件的引用 核心数据存储中的系统路径。 理想情况下,我应该能够找到 即使文件被移动,也可能 跨已安装的卷。 我的理解是 存档的 FSRef 或 AliasRecord 不会解决问题,因为它们 跨安装移动时不是不变的 卷。 所以我的计划是存储一个 URL 并添加一个 UUID(也存储在 数据存储)到文件的 聚焦元数据,以便我能够 执行 Spotlight 查询 UUID(如果 URL 不再指向) 当应用程序返回时的文件 查找该文件。

I would like to modify a Spotlight metadata attribute of a file within my application (i.e. not in a Spotlight importer) but I can't find any API for doing so. Is it possible? Pointers to the relevant docs would be ideal.

In case it's helpful, here's my use case:

I want to store a reference to a file
system path in a Core Data store.
Ideally, I should be able to find the
file even if is moved, potentially
across mounted volumes. My understanding is that
an archived FSRef or AliasRecord will not do the trick because they
are not invariant wrt to moves across mounted
volumes. So my plan was to store a URL
and also to add a UUID (also stored in
the data store) to the file's
Spotlight metadata so that I could
perform a Spotlight query for that
UUID if the URL no longer pointed to
the file when the app goes back to
look for the file.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

じ违心 2024-07-13 17:13:02

经过进一步研究,使用 Spotlight 并不是该用例的最佳解决方案。 AliasRecord 是更好的文件持久存储。 它自动跟踪移动/重命名/等。 您可以在此处了解有关 AliasRecords 的更多信息。 Chris Hansen 为 AliasRecords 编写了一个 Objective-C 包装器,BDAlias。 目前可从 rentzsch.com SVN 获取。

After further research, using Spotlight is not the best solution for the use case. The AliasRecord is a better persistent storage for a file. It automatically tracks moves/renames/etc. You can read more about AliasRecords here. Chris Hansen has written an Objective-C wrapper for AliasRecords, BDAlias. It's currently available from the rentzsch.com SVN.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文