annotate python/window_path.py @ 698:3481ac810b60

chmod
author Jeff Hammel <k0scist@gmail.com>
date Tue, 12 Aug 2014 16:44:26 -0700
parents 83bc1e6e5b54
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
129
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 import os
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 import subprocess
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 import sys
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 import window_title
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 def main(filename):
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 title = window_title.active_window_title()
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 path = os.path.expanduser(title)
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 if not os.path.exists(path):
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 return
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 path = os.path.abspath(path)
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 return os.path.join(path, filename)
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 if __name__ == '__main__':
83bc1e6e5b54 part of a dream realized
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 print main(sys.stdin.read().strip())