[Pythonmac-SIG] Mach-O MacPython IDE!!!
Donovan Preston
dp@ulaluma.com
Thu, 20 Dec 2001 21:24:33 -0800
On Thursday, December 20, 2001, at 08:46 PM, Tony Lownds wrote:
> Donovan wrote:
>> 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.
>>
>
> How would FSSpec_New know if you are passing a unix path or a mac path?
> The API for those two is different. And all possible unix paths are
> possible mac paths; on the mac / is legal in filenames and : is the
> path delimiter, and on unix vice versa. So guessing that "/hello/world"
> is a unix path would be hasty.
Hmm. Well, I suppose the only way to get around this is to explicitly
state which type of path is being used as Jack suggested, or to always
assume slash-delimited paths on X and colon-delimited paths on 9.
Since os.path.join creates slash-delimited strings on X, all of the
places in the IDE where there is code that looks like
os.path.join(rootdir, 'my:subdir:etc') are going to have to be replaced
anyway. I suggest replacing them with os.path.join(*[rootdir, 'my',
'subdir', 'etc']) which works no matter what OS you are running under.
Then, assuming all paths on X are slash delimited, we can insert the
code to convert from a slash-delimited string to a colon-delimited
string in FSSpec_New only if MacPython is being compiled as Mach-O.
Maybe I'll get around to doing it and submitting a patch.
Donovan