1 """An easy way to get ROX-Filer to do things."""
3 # Note: do a double-fork in case it's an old version of the filer
4 # and doesn't automatically background itself.
6 """Run a new process and forget about it."""
7 from os
import fork
, _exit
, execvp
, waitpid
18 print "Warning: exec('%s') failed!" % argv
[0]
21 print "Error: fork() failed!"
24 print "Error: fork() failed!"
28 """Run rox (either from PATH or through Zero Install) with the
31 for dir in os
.environ
.get('PATH', '').split(':'):
32 path
= os
.path
.join(dir, 'rox')
33 if os
.path
.isfile(path
):
34 _spawn(('rox',) + args
)
36 if os
.path
.exists('/uri/0install/rox.sourceforge.net'):
37 _spawn(('/bin/0run', 'rox.sourceforge.net/rox 2002-01-01') + args
)
39 print "Didn't find rox in PATH, and Zero Install not present. Trying 'rox' anyway..."
40 _spawn(('rox',) + args
)
43 "Open 'dir' in a new filer window."
44 spawn_rox(('-d', dir))
47 """'file' may have changed (maybe you just created it, for example). Update
48 any filer views of it."""
49 spawn_rox(('-x', file))
52 """Open a directory and draw the user's attention to this file. Useful for
53 'Up' toolbar buttons that show where a file is saved."""
54 spawn_rox(('-s', file))