Skip to content

Commit

Permalink
Desktop: Fixed issue with issue with watching file on Linux (#1659)
Browse files Browse the repository at this point in the history
Watch for rename events in the external editor and re-watch file
  • Loading branch information
CalebJohn authored and laurent22 committed Jun 19, 2019
1 parent 3819897 commit b461625
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ReactNativeClient/lib/services/ExternalEditWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -297,4 +305,4 @@ class ExternalEditWatcher {

}

module.exports = ExternalEditWatcher;
module.exports = ExternalEditWatcher;

0 comments on commit b461625

Please sign in to comment.