summaryrefslogtreecommitdiffstats
path: root/combox
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-03-18 21:50:37 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-03-18 21:50:37 -0400
commit0445b953c79b4816fabe14996e4e6e63dd664ed6 (patch)
treedd4f2a7c157a7302a44b54fb8ea7d05f8931f59a /combox
parentf1bfe57f02e37049f585211d02ed6206f62e4ee8 (diff)
fleshed out the on_move method in combox.events.NodeDirMonitor
As usual, wrote correponding tests for it; zarking TDD or whatever :~| modified: combox/events.py modified: tests/events_test.py
Diffstat (limited to 'combox')
-rw-r--r--combox/events.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/combox/events.py b/combox/events.py
index 5cdd54f..12d0cbe 100644
--- a/combox/events.py
+++ b/combox/events.py
@@ -235,6 +235,21 @@ class NodeDirMonitor(LoggingEventHandler):
super(NodeDirMonitor, self).on_moved(event)
self.silo_update()
+ src_cb_path = cb_path(event.src_path, self.config)
+ dest_cb_path = cb_path(event.dest_path, self.config)
+
+ if not path.exists(dest_cb_path):
+ # means this path was move on another computer that is
+ # running combox.
+ try:
+ os.rename(src_cb_path, dest_cb_path)
+ except OSError, e:
+ print "Jeez, failed to rename path.", e
+
+ if not event.is_directory:
+ self.silo.remove(src_cb_path)
+ self.silo.update(dest_cb_path)
+
def on_created(self, event):
super(NodeDirMonitor, self).on_created(event)