1 """An easy way to get ROX-Filer to do things."""
3 rox_filer_interface
= "http://rox.sourceforge.net/2005/interfaces/ROX-Filer"
5 # Note: do a double-fork in case it's an old version of the filer
6 # and doesn't automatically background itself.
8 from os
import fork
, _exit
, execvp
, waitpid
19 print "Warning: exec('%s') failed!" % argv
[0]
22 print "Error: fork() failed!"
25 print "Error: fork() failed!"
29 """Run rox (either from PATH or through Zero Install) with the
32 binpath
= os
.environ
.get('PATH', '').split(':')
33 # Try to run with '0launch'
34 for bindir
in binpath
:
35 path
= os
.path
.join(bindir
, '0launch')
36 if os
.path
.isfile(path
):
37 _spawn(('0launch', rox_filer_interface
) + args
)
40 for bindir
in binpath
:
41 path
= os
.path
.join(bindir
, 'rox')
42 if os
.path
.isfile(path
):
43 _spawn(('rox',) + args
)
45 # Try to run through the zero install filesystem
46 if os
.path
.exists('/uri/0install/rox.sourceforge.net'):
47 _spawn(('/bin/0run', 'rox.sourceforge.net/rox 2002-01-01') + args
)
49 print "Didn't find rox in PATH, and Zero Install not present. Trying 'rox' anyway..."
50 _spawn(('rox',) + args
)
53 "Open 'dir' in a new filer window."
54 spawn_rox(('-d', dir))
57 """'file' may have changed (maybe you just created it, for example). Update
58 any filer views of it."""
59 spawn_rox(('-x', file))
62 """Open a directory and draw the user's attention to this file. Useful for
63 'Up' toolbar buttons that show where a file is saved."""
64 spawn_rox(('-s', file))