文件类型痛苦 - 可可

发布于 2024-12-26 02:56:12 字数 308 浏览 4 评论 0原文

因此,我们最近发布了一个基于文档的应用程序,但遗憾的是,我们的主要文档类型的 UTI 留空。我们给它起了一个名字,但标识符却是空的。

一切仍然运行良好,但随后我们添加了另一种文件类型。新的文件类型就是 xml(符合 public.xml)。我们进行了设置并将其放入文档中。这时我们发现了对第一种文档类型的 UTI 的疏忽。

现在,如果我们触摸这种文档类型,BOOM。应用程序无法读取它创建的任何该类型的文件。我们确实想清理这个问题,那么最好的方法是什么?

我的问题本质上是: 如何在基于文档的应用程序中迁移主要文档类型?

So we recently shipped a document based application with an unfortunate oversight: the UTI for our main document type was left blank. We had a name for it, but the identifier was straight up empty.

Everything still worked great, but then we went to add another file type to the mix. The new file type is simply xml (conforms to public.xml). We set that up and dropped it into the document. This is when we caught our oversight on the first document type's UTI.

Now, if we so much as touch this document type, BOOM. The application can't read any files it has created of that type. We really want to clean this up, so what's the best way to do so?

My question is essentially:
How do you migrate your main document type in a document based application?

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

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

发布评论

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

评论(1

煞人兵器 2025-01-02 02:56:12

首先,在用于削减构建的机器上调试此类问题非常困难。动态 UTI 系统对于哪个应用程序拥有哪些文件感到困惑。要解决此问题,您可以在终端中运行一个命令 清除系统上的文件关联。

接下来,我们处理应用程序的实际文档类型。最终,我们只想支持两种文档类型:我们的自定义类型和 xml 类型。然而,我们必须保留已发送的空的、动态生成的 UTI。在“文档类型”中,我们有三种:我们真正想要支持的两种和我们不再想要的遗留类型。对于前两个,我们的应用程序是“编辑器”。对于旧版本,我们将其更改为“Reader”。

另一件真正对我们的系统有帮助的事情是使用导出和导入的 UTI。我们告诉系统我们的应用程序导入 XML 类型,并导出其他两个类型。

我们已经完成了一些非常重要的测试,包括部署,并且此配置非常有效。

First, it's very difficult to debug this type of problem on the machine you're using to cut builds. The dynamic UTI system gets confused as to which app owns which files. To solve this issue, there is a command you can run in terminal to clear out the file associations on your system.

Next, we tackled the actual document types of our application. Ultimately, we want to support just two document types, our custom type and the xml type. However, we had to keep that empty, dynamically generated UTI that was shipped. In "Document types", we have three: the two we actually want to support and the legacy one we no longer want. For the first two, our application is an "Editor". For the legacy one, we changed it to "Reader".

Another thing that really helped our system out is using exported an imported UTIs. We told the system our application imports the XML type, and exports the two others.

We've done some pretty significant testing, including deployment, and this configuration works like a charm.

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