Commit 539acfdb authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

WatchService: fixed: non-ASCII character handling in file path, filtering & cleanup

parent c9320547
......@@ -48,7 +48,7 @@ var CodeEditorPreview = Emitter.extend({
if (data.watch_id != "preview") {
return;
}
if (data.event != "modify") {
if (data.event == "vanish") { // TODO: actually do something useful
return;
}
self.previewChanged = true;
......
......@@ -71,9 +71,8 @@ class FileSystem(object):
return "Basedir now exists"
def close(self):
if self._monitor_thread:
self._monitor_thread.remove_all_watches()
self._monitor_thread.running = False
if self.watchservice:
self.watchservice.stop()
def get_mime_type(self, filepath):
filepath = self.expand(filepath)
......@@ -622,7 +621,7 @@ class WatchService(object):
if not path:
return self.unsubscribe(id)
path = os.path.expanduser(os.path.expandvars(path))
path = os.path.expanduser(os.path.expandvars(path)).encode('utf8')
with self.lock:
if id not in self.subscribers:
......@@ -670,7 +669,7 @@ class WatchService(object):
for subscriber in self.subscriber_buffer[:]:
subscriber.flush(False)
for subscriber in self.subscribers:
for subscriber in self.subscribers.items():
subscriber.destroy()
self.monitor.remove_all_watches()
......@@ -705,7 +704,7 @@ class WatchSubscriber(object): # this should never be instanced manually
del self.event_buffer
def process(self, event, subject=""):
if self.watch.isdir and subject and self.pattern and self.pattern.search(subject) != self.reverse:
if self.watch.isdir and subject and self.pattern and bool(self.pattern.search(subject)) != self.reverse:
return
if event in WatchSubscriber.EVENT_DELAYS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment