Reputation: 11740
Scenario
I need to convert a folder to .dmg using objective-c however, I am not able find any script in obj-c that is why I am looking for a terminal command that can do this.
Research
I am using the given below terminal command in order to convert a folder to .dmg
hdiutil create -format UDZO -srcfolder
"/Users/Paxcel/Desktop/IMG"
"/Users/Paxcel/Desktop/IMG.dmg"
Problem
The above command is not working and giving no result as shown in the screenshot given below:
Please suggest a solution that can help me create a .dmg file of a folder. Many thanks for your attention.
P.S: I have to use either obj-c or terminal because I am creating an utility in cocoa app.
Upvotes: 1
Views: 489
Reputation: 11740
Using " was a mistake. I am from windows world and there (in windows) you always have to put a path into quotes "c://test.txt"
Earlier (Wrong)
hdiutil create -format UDZO -srcfolder
"/Users/Paxcel/Desktop/IMG"
"/Users/Paxcel/Desktop/IMG.dmg"
Correct
hdiutil create -format UDZO -srcfolder
/Users/Paxcel/Desktop/IMG
/Users/Paxcel/Desktop/IMG.dmg
However if you path contains spaces then if you use quotes then it will give an error like given below
Resolution In order to escape the error you must use '\' before spaces ' ' as given below:
hdiutil create -format UDZO -srcfolder
/Users/Paxcel/Desktop/IMG\ for\ design
/Users/Paxcel/Desktop/IMG\ for\ design.dmg
I have run both commands and the result is shown in the screen shot given below
Quoted path is not working but using '\' in path is working like a charm
Upvotes: 2
Reputation: 9721
You have a stray "
in your command line.
The >
prompt means more please; the shell wants you to terminate the "
.
Upvotes: 1