brian d foy has some code to convert Mac OS paths to Mac OS X paths, and vice versa. To do this, he needs to know the startup volume (because on Mac OS X the startup volume is
I sent him some code I think others might find interesting and/or useful.
The MacPerl module (which runs in a limited fashion under Mac OS X perl, in Mac::Carbon) has a function called Volumes(), which returns all mounted volumes in list context, and the startup volume in scalar context. The paths returned text representations of FSSpec data structures, which can be converted to native paths (with slashes in Mac OS X, and colons in Mac OS) with MacPerl::MakePath():
$ perl -MMacPerl=all -le 'print join "\n", map { MakePath($_) } Volumes()'
/
/Volumes/Bourque
/Volumes/Bird
/Volumes/Diablo II Play Disc
/Volumes/Diablo II Cinematics
But that is not too helpful for getting the startup volume name under Mac OS X. You can, however, merely strip off everything up to the ":" in the FSSpec to get the volume name:
$ perl -MMacPerl -le 's/^.+://, print for MacPerl::Volumes()'
Orr
Bourque
Bird
Diablo II Play Disc
Diablo II Cinematics
Now Playing: Growing Young - Rich Mullins (The World As Best As I Remember It, Vol. 2)
Pudge Patch #8675309 (Score:1)
Now that you have Mac::Carbon available, I need to get my nose in the Carbon docs, what there is of them anyway, and see what I can do without AppleScript. My priority, though, is to figure out the PropertyList manager because Mac::PropertyList needs more help than Mac::Path::Util.
Of course, you could just join the Sourceforge p
SF.net (Score:1)
But yeah, I am not pushing you to make the changes, just making suggestions, and I figured other people might find this particular snippet useful. My only concern is that Mac::Carbon is still "development" level, but then again, what isn't?
As to Mac::PropertyList, my main wish for it is multilevel data structures. When I wrote a script for eyetv [macperl.org] I did an ugly hack to flatten ever