[Pythonmac-SIG] Mach-O MacPython IDE!!!

Jack Jansen jack@oratrix.nl
Fri, 21 Dec 2001 13:36:08 +0100


Recently, Donovan Preston <dp@ulaluma.com> said:
> Ah. I had read some discussion about FSRefs vs FSSpecs on Carbon-dev, 
> but never had to deal with it so didn't pay much attention; can an FSRef 
> be used wherever an FSSpec is called for in a Carbon call? Or do you 
> have to create an FSRef and convert it to an FSSpec?

In C you have to do the conversion yourself. In Python you don't:
anywhere an FSRef is required you can also pass either an FSSpec or a
pathname, and anywhere an FSSpec is required you can also pass an
FSRef or a pathname. Lovely language, Python :-)

> I suppose the problems with slash delimited paths could therefore be 
> solved by changing the FSSpec_New code to first create an FSRef and then 
> convert it to an FSSpec.
> 
> Then the only problem remaining is all of the hardcoded colon delimited 
> strings littered throughout the MacPython IDE code. They should all be 
> replaced with calls to os.path.join. That way it works on either 9 or X.

How about the following (I think I suggested this before but didn't
get any answer):
macfs.FSSpec() and macfs.FSRef() get an optional second parameter,
which can be either "mac" or "unix". If you pass a string first
parameter then the second parameter governs how the pathname is
interpreted.

Also, fsspec.as_pathname() and fsref.as_pathname() get an optional
parameter "mac" or "unix" which give the type of pathname you want.

Default is "mac" for MacPython, "unix" for MachoPython.

Hmm, we could even add "url" as a third choice, although that's
probably feeping creaturism.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack        | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm