[Pythonmac-SIG] MachoPython and os.getbootvol()?

Chris Barker Chris.Barker@noaa.gov
Mon, 4 Nov 2002 09:59:10 -0800


On Monday, November 4, 2002, at 08:45 AM, Kevin Ollivier wrote:
> I'm now trying to implement support for absolute links. (i.e. 
> file:///mydir/myfile.ext) The problem is that packages like 
> Dreamweaver create links like so: "file:///Macintosh 
> HD/Users/myname/myfile.ext".

Your fundamental problem is that you shouldn't use absolute pathnames 
at all, except for the call into the project dir in the beginning.

That being said, you certianly are faced with dealing with them once in 
a while.

>  Of course, "Macintosh HD" is not used to denote the root of the 
> volume under OS X, although on OS 9 it is.

"Macintosh HD" is the essentially "/" from the Unix side. I'd do a 
simple: filepath.replace("/Macintosh HD/", "/")

that, of course will break as soon as someone re-names theor main HD, 
but that's a problem with the old-style mac path as well. all I can 
say, is that the Unix standard for paths, and mounting drives on one 
big file system, really is a much better way to go!

>  I tried URLParse and urlretrieve but they both fail, so I considered 
> stripping out the boot volume name

did this really not work?? What happened? are you trying to do an 
os.path.something on a pathname with the "file://" st the beginning? 
this will fail, at the file://.. is a url, not a pathname. try stipping 
off the file:// as well.


Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov