1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-13 22:12:50 +02:00

Desktop: Fixed issue with issue with watching file on Linux (#1659)

Watch for rename events in the external editor and re-watch file
This commit is contained in:
Caleb John
2019-06-19 17:44:51 -06:00
committed by Laurent Cozic
parent 3819897ba1
commit b461625518

View File

@@ -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;
module.exports = ExternalEditWatcher;