[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.
This commit is contained in:
Robey Pointer 2005-02-05 07:45:20 +00:00
parent c1ed20c4af
commit ccd64202d9
1 changed files with 8 additions and 1 deletions

View File

@ -9,11 +9,18 @@
import sys, os, base64, getpass, socket, traceback import sys, os, base64, getpass, socket, traceback
import paramiko import paramiko
if os.environ.has_key('HOME'):
# unix
HOME = os.environ['HOME']
else:
# windows
HOME = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
##### utility functions ##### utility functions
def load_host_keys(): def load_host_keys():
filename = os.environ['HOME'] + '/.ssh/known_hosts' filename = HOME + '/.ssh/known_hosts'
keys = {} keys = {}
try: try:
f = open(filename, 'r') f = open(filename, 'r')