#!/usr/bin/python # Paul Wright, 2005. This file is in the public domain. # # Firefox's process creation is broken on the Mac, causing it to throw an # exception if you pass a process some arguments. The mozex stuff always # creates temporary files and then invokes the editor, so we can work around # the problem by looking for the newest file at the point where we run: # even if the user saves other files in the directory in the meantime, they # probably won't save just as Mozex invokes us again. mozex_temp_dir = '/Home/paul/mozex-temp/' editor_command = '/Users/paul/bin/gvim %s' import os os.chdir(mozex_temp_dir) os.stat_float_times(1) files = os.listdir(mozex_temp_dir) files = [(f, os.stat(f).st_mtime) for f in files] files.sort(lambda x,y: cmp(x[1], y[1])) newest = files[-1][0] os.system(editor_command % newest)