Intelligence Gear
Intelligence Gear

Reputation: 279

Is there a framework in Cocoa to create and manipulate ISO disk image?

I want to ask whether there is a framework of Cocoa to create and manipulate ISO disk image. Actually, I want to find one Cocoa alternative for .NET DiscUtils(http://discutils.codeplex.com/).

Upvotes: 2

Views: 531

Answers (1)

Dietrich Epp
Dietrich Epp

Reputation: 213837

If you want to create ISO images on the Mac, you can call hdiutil. See man hdiutil.

Start by putting your files in a temporary directory, say, /tmp/xyz/volume. (Use mkdtemp). Then run:

$ hdiutil create -srcfolder /tmp/xyz/volume -format UDTO /tmp/xyz/image.cdr

This will create a "CDR Master" image. You can then convert it to ISO:

$ hdiutil makehybrid -iso -joliet -o /path/to/image.iso /tmp/xyz/image.cdr

You can then delete the temporary directory.

Now, I know that this isn't a "framework" per se. Instead you're calling external programs to do the work for you. You'll need to learn how to use fork/exec, popen, NSTask, or one of the other variants.

As an alternative, you could build a copy of mkisofs and place that inside your application bundle. The interface to mkisofs is somewhat nicer for creating ISO images, it's just not bundled with Mac OS X the way hdiutil is.

Upvotes: 2

Related Questions