From ccd64202d95d968afbd132b9d32f2842cba39784 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Sat, 5 Feb 2005 07:45:20 +0000 Subject: [PATCH] [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. --- demo_windows.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/demo_windows.py b/demo_windows.py index 5d87090..84e3ec6 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')