diff options
author | Robey Pointer <robey@lag.net> | 2005-02-05 07:45:20 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-02-05 07:45:20 +0000 |
commit | ccd64202d95d968afbd132b9d32f2842cba39784 (patch) | |
tree | a04abb41fe53f683deb2db7a9b14fea86a0a27ff | |
parent | c1ed20c4afaa4715f0ec1f4f802a587b3935f48f (diff) |
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-142]
fix windows sample script's HOME
fix the HOME environ var to work on windows too.
-rwxr-xr-x | demo_windows.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/demo_windows.py b/demo_windows.py index 5d870907..84e3ec60 100755 --- a/demo_windows.py +++ b/demo_windows.py @@ -9,11 +9,18 @@ import sys, os, base64, getpass, socket, traceback import paramiko +if os.environ.has_key('HOME'): + # unix + HOME = os.environ['HOME'] +else: + # windows + HOME = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH'] + ##### utility functions def load_host_keys(): - filename = os.environ['HOME'] + '/.ssh/known_hosts' + filename = HOME + '/.ssh/known_hosts' keys = {} try: f = open(filename, 'r') |