From b461625518c6e0250d31fd3992f64279af2b7ec7 Mon Sep 17 00:00:00 2001 From: Caleb John Date: Wed, 19 Jun 2019 17:44:51 -0600 Subject: [PATCH] Desktop: Fixed issue with issue with watching file on Linux (#1659) Watch for rename events in the external editor and re-watch file --- ReactNativeClient/lib/services/ExternalEditWatcher.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ReactNativeClient/lib/services/ExternalEditWatcher.js b/ReactNativeClient/lib/services/ExternalEditWatcher.js index bd5365f099..4632f54758 100644 --- a/ReactNativeClient/lib/services/ExternalEditWatcher.js +++ b/ReactNativeClient/lib/services/ExternalEditWatcher.js @@ -87,6 +87,14 @@ class ExternalEditWatcher { this.logger().error(error) } }); + // Hack to support external watcher on some linux applications (gedit, gvim, etc) + // taken from https://github.com/paulmillr/chokidar/issues/591 + this.watcher_.on('raw', async (event, path, {watchedPath}) => { + if (event === 'rename') { + this.watcher_.unwatch(watchedPath); + this.watcher_.add(watchedPath); + } + }); } else { this.watcher_.add(fileToWatch); } @@ -297,4 +305,4 @@ class ExternalEditWatcher { } -module.exports = ExternalEditWatcher; \ No newline at end of file +module.exports = ExternalEditWatcher;