From 590a4f5d984b27c0b6f120f7e131876b45a20f2d Mon Sep 17 00:00:00 2001 From: Roel Date: Thu, 24 Apr 2014 17:41:52 +0200 Subject: [PATCH] fixed bug where ip_to_hash made a "node" dir for every node --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e171ef9..b965136 100755 --- a/main.py +++ b/main.py @@ -47,7 +47,7 @@ class Meshenger: sys.exit() while True: - + print 'Entering main loop' if len(self.devices) > 0: print 'found', len(self.devices),'device(s)' @@ -186,11 +186,13 @@ Get new messages from other node based on it's index file """ Convert a node's ip into a hash and make a directory to store it's files """ + if not os.path.exists('nodes'): + os.mkdir('nodes') + import hashlib hasj = hashlib.md5(ip).hexdigest() - nodepath = os.path.join(os.path.abspath('nodes/'), hasj) + nodepath = os.path.join(os.path.abspath('nodes'), hasj) if not os.path.exists(nodepath): - os.mkdir('nodes') os.mkdir(nodepath) return nodepath