view python/window_path.py @ 807:26786fae0703

this relies on a requirement that is not part of my (2.7.12) stdlib; i almost deleted it. instead, i will keep for fun and note the requirement for further research
author Jeff Hammel <k0scist@gmail.com>
date Fri, 28 Oct 2016 17:09:04 -0700
parents 83bc1e6e5b54
children
line wrap: on
line source

#!/usr/bin/env python

import os
import subprocess
import sys
import window_title

def main(filename):
    title = window_title.active_window_title()
    path = os.path.expanduser(title)
    if not os.path.exists(path):
        return
    path = os.path.abspath(path)
    return os.path.join(path, filename)

if __name__ == '__main__':
    print main(sys.stdin.read().strip())