[Pythonmac-SIG] mac.chdir ?

Jack Jansen Jack.Jansen@cwi.nl
Tue, 27 Oct 1998 20:37:34 +0100


Recently, "Steven D. Majewski" <sdm7g@virginia.edu> said:
> SetFolder() seems to work for me, however what it does isn't what my
> code fragment does. 

Yes, but as was mentioned before it only works if you have the right
settings in the "general controls" control panel:-(

I'm working on a different hook for setting the folder for the
StandardFile calls, probably an extra optional argument that signifies 
the folder where you want to go. It's not simple, though, because
it'll have to use the event hook, and that's already used for other
things. 

> All I wanted was a quickie to set the current directory interactively:
> 
>  os.chdir( macfs.GetDirectory()[0].as_pathname() )

A good place to put this would be the interactive startup file, or, if 
you use the IDE, the scripts folder.

> But this topic always tends to get confusing because the problem is
> that there's TWO "current-directories" -- the POSIX/STDIO getcwd() 
> current-working-directory, and the Mac standard file dialog Current
> Folder and they don't track each other of have any connection. 

This is because the MacOS doesn't really have a working directory
concept. I keep noticing that various extensions also muck with
Python's idea of the working directory: Click there it is! is one of
them, and the valuefax receiver is another. There's unfortunately
little to do about this, short of completely ignoring MacOS's working
directory and keeping the working directory ourselves:-(

> If there's a function missing from the set, it's a way to get the
> current Standard File Current Folder. I don't see that anywhere --
> am I missing something ?

It's the return value of macfs.SetFolder().

> BTW: For the original question, how about making os.getcwd() into
> a wrapper around the existing getcwd(), with a no-arg-optional
> behaviour that calls GetDirectory ? 

What exactly do you solve here?
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl      | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm