combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit 2511b80565206f40f7059376ab876999c7adaae7
parent e6669c8971cd3f3dd8fd1de5608b9bd4ebcecef6
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Wed, 25 Feb 2015 22:40:22 -0500

updated combox.events.ComboxDirMonitor.on_create method

Now the file shards or directory is created in the node directories
only if they don't already exist; if they exist that means this file
was created from another computer (also running combox).

	modified:   combox/events.py

Diffstat:
combox/events.py | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/combox/events.py b/combox/events.py @@ -26,7 +26,7 @@ from watchdog.events import LoggingEventHandler from combox.crypto import split_and_encrypt, decrypt_and_glue from combox.file import (mk_nodedir, rm_nodedir, rm_shards, relative_path, move_shards, move_nodedir, - cb_path) + cb_path, node_path) from combox.silo import ComboxSilo @@ -120,10 +120,13 @@ class ComboxDirMonitor(LoggingEventHandler): def on_created(self, event): super(ComboxDirMonitor, self).on_created(event) - if event.is_directory: + file_node_path = node_path(event.src_path, self.config) + + if event.is_directory and (not path.exists(file_node_path)): # creates a corresponding directory at the node dirs. mk_nodedir(event.src_path, self.config) - else: + elif (not event.is_directory) and (not path.exists( + file_node_path)): # file was created split_and_encrypt(event.src_path, self.config) # store file info in silo.