开发者

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

开发者 https://www.devze.com 2023-01-05 09:10 出处:网络
Is there an开发者_如何学Pythony library to create a disk image from Cocoa, or is it only possible through Finder?I\'m not aware of a way to do it directly from Cocoa (though there might be one) but th

Is there an开发者_如何学Pythony library to create a disk image from Cocoa, or is it only possible through 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消