简体   繁体   English

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

[英]Creating a disk image (.dmg) from Objective-C

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

I'm not aware of a way to do it directly from Cocoa (though there might be one) but there is another way. 我不知道从Cocoa 直接做的方法(尽管可能有一个),但还有另一种方法。 The hdiutil tool can be used from the Terminal, and you can call it from your program as well. hdiutil工具可以在终端上使用,您也可以从程序中调用它。 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. 似乎http://www.cocoabuilder.com/archive/cocoa/152742-disc-image-apis.html描述了同样的问题。

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

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

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