PDA

View Full Version : Folder Background Image on a CD




IJ Reilly
Jun 11, 2006, 05:08 PM
I am trying to create a CD which has a background picture for the folder. So I created a disk image in Disk Utility, dragged in the items I wanted on the CD, then added the picture in View Options. Looks great. Now I burn a CD from the disk image. The finished CD mounts on the desktop, I open it -- still looks great. Then I insert the CD into two other Macs. Now the folder background is white. Apparently the background image has to be stored somewhere on the CD. How do I keep the folder background on the CD, so it can be seen on any Mac?



robbieduncan
Jun 11, 2006, 05:25 PM
It's probably best described as "complicated" as the Finder really likes messing around with the .DS_Store file that tells it which mode to display the folder in.

The basic approach is to copy the file to the CD as a hidden file.

If you download the source to Poster Paint (see my sig) you will see how I do this for the dmg I distribute the app as. I use a nice Mozilla tool (well as slightly modified version of it: see the source archive) to create the DMG, but it relies on having an appropriate .DS_Store file to start with.

You may find this page (http://jwz.livejournal.com/608927.html) useful. I used it to get the info to make my dmg. If you can get the DMG to create you could just burn that as a CD.

IJ Reilly
Jun 11, 2006, 07:32 PM
Yikes.

I wonder, if I just drag the background image file to the disk image, will that do the trick (assuming I don't care if anyone sees it there)?

jimsowden
Jun 11, 2006, 08:01 PM
I think I remember seeing disks like that, yes.

robbieduncan
Jun 12, 2006, 02:48 AM
If everything is working when you put the image one the CD then making the image file itself hidden is quite easy.

Do this to set the image.

1) Create a folder on the cd called background
2) Copy the image into that folder
3) Rename the folder to .background (the Finder may not let you, if this is the case use the Terminal mv command to move background to .background).
4) The folder is now invisible
5) Set the background: you cannot navigate to the folder normally, when the window to navigate in is open hit Shift-Command-G to bring up the go-to-folder box and type in the full path including .background. Now you can select the file within the hidden folder.

mad jew
Jun 12, 2006, 02:59 AM
I think I remember doing this in Panther and you're right IJ Reilly, all I did was drag the image to the disk image and then set it as the background. I don't think it'll work the other way around, although I guess it's worth a try. I didn't bother hiding the image but that's always useful to know robbieduncan. I don't have any blank discs nearby to test this on although I guess I could try it with DMGs once I've finished this uni assignment. :)

bigandy
Jun 12, 2006, 04:20 AM
Toast does it pretty easily if I remember correctly... either that or i'm still drunk from last night...

IJ Reilly
Jun 12, 2006, 10:19 AM
I found a freeware application called HideOut (http://www.versiontracker.com/dyn/moreinfo/macosx/15281). I have not tried it yet, but it's supposed to make any file invisible. If I understand correctly, it only adds a dot before the name, which means I'd still have to navigate to it in the Finder to set it as the background.

robbieduncan
Jun 12, 2006, 10:32 AM
I found a freeware application called HideOut (http://www.versiontracker.com/dyn/moreinfo/macosx/15281). I have not tried it yet, but it's supposed to make any file invisible. If I understand correctly, it only adds a dot before the name, which means I'd still have to navigate to it in the Finder to set it as the background.

The developer tools include another way of seting a file to be invisible via SetFile. HFS+ has a hidden bit that you can set allowing the file to be invisible but with the same name as before...

IJ Reilly
Jun 12, 2006, 10:41 AM
The developer tools include another way of seting a file to be invisible via SetFile. HFS+ has a hidden bit that you can set allowing the file to be invisible but with the same name as before...

I have the developer tools installed, and find SetFile, but it's a Unix Executable, which means I don't have a clue how to use it. Also, I'm concerned that I won't be able to find the file once it's set to invisible, using the method required by the Finder, which is navigating to the folder and using View Options to set the background color/image with the radio button. What am I missing?

BTW, thanks to everyone for the help. I'm really learning something new here today, :)

robbieduncan
Jun 12, 2006, 11:22 AM
It's a command line utility. You use it from the Terminal. The idea is that you copy the file to the CD image, set the background and THEN make the file invisible :D

You cannot set the background to a file starting with a dot easily, which is why my method above uses a folder that starts with a dot as you can get the finder to show that folder, but not a similar file. Note that if you set the background to a file, then make that file invisible by adding the dot the filename changes and the background will not longer work (worse still it will appear to work until you relaunch the Finder on your machine).

IJ Reilly
Jun 12, 2006, 11:37 AM
I hope I'm not being tedious here... but I'll need step by step instructions for using the Terminal approach.

1/ Copy the background image to the disk image.
2/ Set it as the background with the Finder.
3/ ??

robbieduncan
Jun 12, 2006, 02:56 PM
3) Open Terminal
4) Use the cd command (Change Directory) to cd to the folder that the image is in. You can work out the folder from the Finder. (I think(.
5) Use SetFile:

/Developer/Tools/SetFile -a V <filename>

where <filename> is the name of the file

For some reason SetFile is not working for me though!

XNine
Jun 12, 2006, 03:36 PM
The easist way to do this (in my experience) is using FILEBUDDY (find it on macupdate). You can then drag the image to the folder, make it invisible, and set it as the background via the finder.

IJ Reilly
Jun 12, 2006, 05:03 PM
3) Open Terminal
4) Use the cd command (Change Directory) to cd to the folder that the image is in. You can work out the folder from the Finder. (I think(.
5) Use SetFile:

/Developer/Tools/SetFile -a V <filename>

where <filename> is the name of the file

For some reason SetFile is not working for me though!

This seems to have worked! I placed the jpeg file on desktop, ran the script, and the icon dimmed. I dragged that file to the disk image, which replaced the non-hidden version, unmounted the disk image, remounted it and -- it's hidden! Either that, or gone... I'm not sure how to confirm that it exists. Possibly TinkerTool will show it.

BTW, I'd previously tested simply copying the graphic to the disk image, and changing the background to the one on the disk image. I burned that, and it showed up properly on another Mac, so this was the solution to that part of the problem.

j-birder
Jun 15, 2006, 09:26 PM
I'm unable to get this to work programmatically using the mozilla pkg-dmg script. When I mount the .dmg, the finder window appears in the correct place and is the correct size, and the file icons appear in the correct places. But, the background image does not appear. It is present, just not displayed.

I can create a .dmg manually and have the background display nicely. It's just that I cannot get the pkg-dmg script to work. I assume that the problem has something to do with the .DS_Store file that I use, but I cannot figure out what the problem is. Here is how I create it.

1) Use disk utility to create a 10 MB image that is read/write.
2) Use command-line mkdir to create a hidden directory that will hold the background image.
3) Use command-line cp to copy the background image into the new directory. (It is a .png file.)
4) Use command-line mv to move into the new disk image the application and its file of release notes.
5) Use Finder -> View -> Show view options to set
- This folder only
- Set the background image
6) Close folder and unmount disk image by dragging it to the trash
7) Re-open disk image
8) Use command-line cp to copy .DS_Store from the image to a file named just DS_Store (no dot) in my application source tree.

Now, if I take the original image, unmount it and create a read-only image from it, the new read-only image works fine. If I create a new image using the pkg-dmg script and then open it, the background image does not appear.

It seems as if I'm doing everything correctly. Does anyone see anything that is obviously wrong? Any suggestions?

Thanks,

j-birder

IJ Reilly
Jun 16, 2006, 12:27 AM
I don't know if you've done everything correctly (though I suppose obviously not, I just couldn't tell you why not), but I think the method I used is a lot easier. If the background image resides on the disk image and is selected by the Finder, it will "stick" when the disk image is burned. The trick is making that image file hidden, which I was able to do with a single command line instruction and no movement of .DS_STORE files. Try it!

j-birder
Jun 16, 2006, 05:36 PM
Yes, I understand that building a disk image manually is not difficult. What I want is an automated build of my application: I issue 2 words and the application is built from scatch and packaged. What I don't want to do is to have to manually build a disk image each time I want to release a new version of a my application. Hence, I'd really like to get the pkg-dmg script to work.

IJ Reilly
Jun 16, 2006, 10:51 PM
I'm not entirely certain I understand what you are trying to accomplish, but you might want to look into Automater.

robbieduncan
Jun 17, 2006, 02:29 AM
Yes, I understand that building a disk image manually is not difficult. What I want is an automated build of my application: I issue 2 words and the application is built from scatch and packaged. What I don't want to do is to have to manually build a disk image each time I want to release a new version of a my application. Hence, I'd really like to get the pkg-dmg script to work.

Poster Paint is able to do this (from within XCode). I simply change the Target to Package and it builds the app and then packages that into a nice .dmg with a background image and so on. The code is available to download.

The difficult bit is getting a .DS_Store file that works. The way I did it was to create a new folder and set that up the way I wanted and then copy the .DS_Store from it.

j-birder
Jun 17, 2006, 12:08 PM
I've downloaded Poster Paint and poked around. I found your background image, the the copy of DS_Store that you use, and also pkg-dmg. I ran strings on your DMG_DS_Store to see if there was anything in it that is radically different from my DS_Store, and nothing turned up. I diffed your copy of pkg-dmg against the copy that I got from mozilla and found that it differs in ways that should not matter. I couldn't find where you actually invoke pkg-dmg to do its job. To be honest, I'm not familiar with XCode. I'm a java developer and use apache ant to build and package my application. That's part of why I'm really interested in getting pkg-dmg to work.

robbieduncan
Jun 17, 2006, 12:52 PM
I call pkg-dmg from a shell-script build phase in XCode. The shell script executed is below (I believe that it uses sh to execute this):


# Package App to pretty dmg.
mkdir "$SOURCE_ROOT/Packaging/PosterPaint"
cp -R "$BUILD_DIR/Release/Poster Paint.app" "$SOURCE_ROOT/Packaging/PosterPaint/"
cp -f "$SOURCE_ROOT/Read Me.rtf" "$SOURCE_ROOT/Packaging/PosterPaint/"
mkdir "$SOURCE_ROOT/Packaging/PosterPaint/.background"
cp -f "$SOURCE_ROOT/Packaging/DMG Background.tif" "$SOURCE_ROOT/Packaging/PosterPaint/.background/"
cp -f "$SOURCE_ROOT/Packaging/DMG_DS_Store" "$SOURCE_ROOT/Packaging/PosterPaint/.DS_Store"
$SOURCE_ROOT/Packaging/pkg-dmg --source "$SOURCE_ROOT/Packaging/PosterPaint" --target "$SOURCE_ROOT/Packaging/Poster Paint.dmg" --icon "$SOURCE_ROOT/Packaging/DMG.icns" --volname "Poster Paint" --applink
rm -rf "$SOURCE_ROOT/Packaging/PosterPaint"


$SOURCE_ROOT is an XCode variable that (not surprisingly) is the root of the source tree (basically where the .xcodeproj file is).

The .DS_Store file contains a lot of important stuff in binary form.

What, exactly, is the problem you are encountering?

j-birder
Jun 18, 2006, 08:02 AM
My problem is that everything seems to be on the disk image but when I mount it the background image does not appear. Once the image is mounted I can use the finder to turn on the background image, but it does not appear when the image is mounted and opened.

Thanks for posting your code. One difference that I saw in it is that you copy the background image and .DS_Store to the image before invoking pkg-dmg. I was using arguments to pkg-dmg to do those things (--mkdir ... --copy ... --copy). (pkg-dmg uses rsync to copy files.) I tried copying prior to invoking pkg-dmg, as you did, but to no avail.

I'm still perplexed. I also use pkg-dmg to set a volume icon and to add a license dialog when the volume is opened. I may drop both of those to see if they make a difference and if so add them back sequentially. It shouldn't matter, but you never know.

robbieduncan
Jun 18, 2006, 08:09 AM
I still think the issue is with your .DS_Store file. Try doing this:

Create a new dmg on your desktop.
Copy ALL of the contents that will end up in your dmg into this dmg.
Set the background image and any other items you want. The image MUST be within this dmg.

Unmount the DMG.

Remount it. If everything is as you want it copy the .DS_Store out.

j-birder
Jun 18, 2006, 03:25 PM
Yes, I agree that the problem must be in .DS_Store.

I took your advice and rebuilt a .DS_Store file from scratch.
1) New dmg file using disk utility. Outfitted it with the works:
2) Created .background directory and copied in background.png with mkdir and cp
3) Moved application into place using mv
4) Moved a file named RELEASE_NOTES into place using mv
5) Used finder to set background image (this folder only and using the copy of background.png that is on the dmg).
6) Set custom icon using /Developer/Tools/SetFile
7) Unmounted
8) Set license dialog resource using /Developer/Tools/Rez
9) Remounted
10) Copied .DS_Store out

Again, the diskimage that I create by hand works fine, and that produced by pkg-dmg does not display the background image. I've even made sure that my command-line arguments to pkg-dmg are in the same order as those in your script above.

robbieduncan
Jun 18, 2006, 03:28 PM
Then I'm out of ideas.

There are some suggestions here (http://jwz.livejournal.com/608927.html).

j-birder
Jun 19, 2006, 06:58 AM
Thanks, I am out of ideas, too. I've accepted defeat on this one and have gone with a partial solution. I manually create an image, invoke an ant task to populate it, manually adjust size arrangement etc, and then invoke an ant task to pack it and set the license pop-up.

Thanks for your help,

j-birder

robbieduncan
Jun 19, 2006, 07:07 AM
Thanks, I am out of ideas, too. I've accepted defeat on this one and have gone with a partial solution. I manually create an image, invoke an ant task to populate it, manually adjust size arrangement etc, and then invoke an ant task to pack it and set the license pop-up.

Thanks for your help,

j-birder

You might be able to use AppleScript to do the manual bit(s) for you...