Permalink
Browse files

Ignore changes to Vim swap files

  • Loading branch information...
1 parent 4fb54a5 commit 1178881fc99af2e15b5f9be74c114e3a935cd13c @serban committed Aug 31, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 autosync.py
View
@@ -26,6 +26,7 @@
import fsevents
import os.path
import Queue
+import re
import subprocess
import threading
@@ -56,9 +57,13 @@ def schedule_sync():
pass
-def fs_event_callback(path, mask):
+def fs_event_callback(file_event):
global timer
+ # Ignore changes to Vim swap files
+ if re.match('\..*\.swp', os.path.basename(file_event.name)):
+ return
+
if timer and timer.is_alive():
timer.cancel()
@@ -73,7 +78,7 @@ def fs_event_callback(path, mask):
observer = fsevents.Observer()
observer.start()
-stream = fsevents.Stream(fs_event_callback, PATH)
+stream = fsevents.Stream(fs_event_callback, PATH, file_events=True)
observer.schedule(stream)
if __name__ == '__main__':

0 comments on commit 1178881

Please sign in to comment.