简体   繁体   中英

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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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