On Jul 24, 2006, at 8:52 PM, Bob Ippolito wrote: > > On Jul 24, 2006, at 11:17 AM, Christopher Barker wrote: > >> Ronald Oussoren wrote: >>> Why's that? The directory that contains the script is a lot more >>> useful >>> for most scripts. >> Bob Ippolito wrote: >>> No, it's not. There are approximately zero scripts that expect this >>> behavior. >> >> Most "scripts" I've ever used are used from the command line, and the >> working dir is the working dir you call the command from. This pretty >> much all goes to heck when you want to click on it from a GUI. > > It doesn't have to. > >> All the Linux GUIs I've used use $HOME as the default working dir >> when >> you double click on something. >> >> When a script is installed somewhere central, like /usr/local/bin, >> that's really all that makes sense. > > That's clearly irrelevant, because people aren't going to be double- > clicking on files that you have to do "magic incantations" to even > see from Finder.
The main problem here is that there isn't really a "current" directory in the GUI experience. That's why normal application bundles start with / as the CWD. PythonLauncher defaults to $HOME, but that's an implementaton artifact of the default way to launch scripts. For scripts you start by double-clicking on them there is a somewhat useful notion of a current directory: the folder that was frontmost when you double-clicked on the script. AFAIK that is always the folder that the script is in. For simple scripts that would be a very useful default, it saves you from doing path calculation in simple write-once scripts. For reuseable command-line scripts you're obviously better of to find data relative to your script or in some fixed location, but then changing the default wouldn't hurt either. > > But why would you want $HOME as the default working dir? There > doesn't seem to be any purpose to it. Scripts that reference files in > your home directory are always going to do that with an absolute > path. I have never in my life seen a script that must be started > with a working directory of $HOME (unless it also lives there). It is > however extremely common for scripts to require that they are run > from the directory they live in. +lots here. > >> Can you drag-and-drop on a script and have PythonLauncher do argv >> emulation for you? That could be useful. > > I don't think so. Nope, that's not possible. If you want argv emulation you'll have to build an applet. Ronald _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig