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 from os
import fork
, _exit
, execvp
, waitpid
17 print "Warning: exec('%s') failed!" % argv
[0]
20 print "Error: fork() failed!"
23 print "Error: fork() failed!"
27 """Run rox (either from PATH or through Zero Install) with the
30 for bindir
in os
.environ
.get('PATH', '').split(':'):
31 path
= os
.path
.join(bindir
, 'rox')
32 if os
.path
.isfile(path
):
33 _spawn(('rox',) + args
)
35 if os
.path
.exists('/uri/0install/rox.sourceforge.net'):
36 _spawn(('/bin/0run', 'rox.sourceforge.net/rox 2002-01-01') + args
)
38 print "Didn't find rox in PATH, and Zero Install not present. Trying 'rox' anyway..."
39 _spawn(('rox',) + args
)
42 "Open 'dir' in a new filer window."
43 spawn_rox(('-d', dir))
46 """'file' may have changed (maybe you just created it, for example). Update
47 any filer views of it."""
48 spawn_rox(('-x', file))
51 """Open a directory and draw the user's attention to this file. Useful for
52 'Up' toolbar buttons that show where a file is saved."""
53 spawn_rox(('-s', file))