从 Objective-C 创建磁盘映像 (.dmg)

发布于 2024-09-07 14:47:13 字数 48 浏览 2 评论 0原文

是否有任何库可以从 Cocoa 创建磁盘映像,或者只能通过 Finder 来创建?

Is there any library to create a disk image from Cocoa, or is it only possible through Finder?

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

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

发布评论

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

评论(2

情绪操控生活 2024-09-14 14:47:13

我不知道有什么方法可以直接从 Cocoa 做到这一点(尽管可能有),但还有另一种方法。 hdiutil 工具可以从终端使用,您也可以从程序中调用它。以下是从文件夹创建磁盘映像的示例用法:

hdiutil create -fs HFS+ -volname "Volume Name" \
               -srcfolder "/path/to/source/directory" "path/to/filename.dmg"

似乎 http://www.cocoabuilder.com/archive/cocoa/152742-disc-image-apis.html描述了同样的问题。

I'm not aware of a way to do it directly from Cocoa (though there might be one) but there is another way. The hdiutil tool can be used from the Terminal, and you can call it from your program as well. Here's a sample usage for creating a disk image from a folder:

hdiutil create -fs HFS+ -volname "Volume Name" \
               -srcfolder "/path/to/source/directory" "path/to/filename.dmg"

Seems that http://www.cocoabuilder.com/archive/cocoa/152742-disc-image-apis.html describes the same problem.

夏至、离别 2024-09-14 14:47:13

您可以使用 hdiutil 工具,也许可以借助 NSTask。

You could use the hdiutil tool, perhaps with the aid of NSTask.

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