mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +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:
parent
3819897ba1
commit
b461625518
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user