简体   繁体   English

pkgbuild和移动的应用程序

[英]pkgbuild and moved application

I create an application installer with pkgbuild and productbuild tools on OS X. The package I create installs my application to /Application folder. 我在OS X上使用pkgbuild和productbuild工具创建了一个应用程序安装程序。我创建的包将我的应用程序安装到/ Application文件夹中。 Now, if I move this application to another location using NSFileManager(using another my app), my package will reinstall it to the new location but the /Application where it is intended to be installed. 现在,如果我使用NSFileManager(使用另一个我的应用程序)将该应用程序移动到另一个位置,我的软件包会将其重新安装到新位置,但要将其安装到/ Application。

This looks like some file path caching, can I somehow "flush the cash" so my pkg will install app to the right location? 这看起来像一些文件路径缓存,我可以以某种方式“清空现金”,以便我的pkg将应用安装到正确的位置吗?

I noticed this on Mavericks and El Capitan. 我在小牛和埃尔卡皮坦身上注意到了这一点。 I believe this is true for Yosemite too. 我相信优胜美地也是如此。

if I move this application to another location 如果我将此应用程序移到另一个位置

OS X doesn't like multiple, identical copies of the same application. OS X不喜欢同一应用程序的多个相同副本。 The problem is due to the registration of applications when they're seen by Launch Services . 问题是由于启动服务看到应用程序时注册了它们。

When an application is copied into /Applications, or run for the first time, the application details are registered with Launch Services. 当将应用程序复制到/ Applications或首次运行时,该应用程序详细信息会在Launch Services中注册。 When a user runs the application by double-clicking on its bundle, Launch Services looks at the registered applications and decides what actually gets run. 当用户通过双击其捆绑软件运行该应用程序时,Launch Services将查看已注册的应用程序并确定实际运行的内容。

The OS X Installer works in tandem with Launch Services, so when a bundle is due to be copied from a package, it first checks to see if the same application has been registered and exists; OS X Installer与Launch Services协同工作,因此,当要从软件包中复制捆绑软件时,它首先检查是否已注册并存在相同的应用程序; if the application has, then the copy won't occur. 如果应用程序具有,则不会发生复制。 This can be viewed in the Install logs in /var/log/install.log 可以在/var/log/install.log中的安装日志中查看

Having multiple copies of the same application can get confusing and I recommend you don't do this. 同一应用程序有多个副本可能会造成混淆,我建议您不要这样做。 If you want to put aside a bundle and re-install, move it to the Trash, which will remove its registration from Launch Services. 如果您要放置捆绑包并重新安装,请将其移至“废纸rash”,这将从“启动服务”中删除其注册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM