开发者

How to create drag and drop DMG file, Mac installer

开发者 https://www.devze.com 2022-12-11 16:11 出处:网络
Hi I have created an aplication myprogram.app file. Now I want to create Drag 开发者_运维问答and drop DMG file for that application. Skype and other software does the same thing.

Hi I have created an aplication myprogram.app file. Now I want to create Drag 开发者_运维问答and drop DMG file for that application. Skype and other software does the same thing.

How to create Drag and Drop DMG file foe my application.

Thanks Sunil Kumar Sahoo


It's actually pretty easy. You just need to compose some hidden files. Easy way to do this is to just copy someone elses and change to suit your app.

For example, if I mount the MonoDevelop DMG, then I see:

atom:MonoDevelop fak$ ls -al
total 40
drwxr-xr-x   8 fak   staff    340 Nov  4 14:03 .
drwxrwxrwt@ 10 root  admin    340 Nov 10 21:33 ..
-rw-r--r--@  1 fak   staff  12292 Nov  4 14:03 .DS_Store
d-wx-wx-wt   2 fak   staff     68 Nov  4 14:03 .Trashes
drwxr-xr-x   3 fak   staff    102 Nov  4 14:03 .background
drwx------   4 fak   staff    136 Nov  4 14:03 .fseventsd
lrwxr-xr-x   1 fak   staff     13 Nov  4 14:03 Applications -> /Applications
drwxr-xr-x   3 fak   staff    102 Nov  4 14:02 MonoDevelop.app

Here we see .background that is a directory with a PNG file (the background). The app itself (MonoDevelop.app) and a link to /Applications.

The .DS_Store contains the window size, icon positions, etc. Just setup a directory and use the .DS_Store from it.


There's really not any magic to this. You can create a disk image with Disk Utility. Put the stuff on it that you need, and then convert it to a compressed read-only image (again, with Disk Utility).

For some tips on prettying up the appearance of the window, check out this question. If you need to automate this process, check out this other question for some ways to do that.

0

精彩评论

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

关注公众号