You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-editors/atom/files/atom-fix-config-watcher-r1....

42 lines
1.5 KiB

From 5f1f840372611b8f42d8fd3be7b680f90958f015 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
Date: Wed, 28 Mar 2018 18:52:58 -0400
Subject: [PATCH] Unbreak config watcher in the main process
---
src/path-watcher.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/path-watcher.js b/src/path-watcher.js
index 6693489ef..f3ddc6fe4 100644
--- a/src/path-watcher.js
+++ b/src/path-watcher.js
@@ -544,12 +544,22 @@ class PathWatcherManager {
// Private: Access the currently active manager instance, creating one if necessary.
static active () {
if (!this.activeManager) {
- this.activeManager = new PathWatcherManager(atom.config.get('core.fileSystemWatcher'))
- this.sub = atom.config.onDidChange('core.fileSystemWatcher', ({newValue}) => { this.transitionTo(newValue) })
+ let config = this.getConfig()
+ this.activeManager = new PathWatcherManager(config.get('core.fileSystemWatcher'))
+ this.sub = config.onDidChange('core.fileSystemWatcher', ({newValue}) => { this.transitionTo(newValue) })
}
return this.activeManager
}
+ // Private: get config instance for the current application
+ static getConfig() {
+ if (typeof(global.atom) != 'undefined') {
+ return global.atom.config
+ } else {
+ return global.atomApplication.config
+ }
+ }
+
// Private: Replace the active {PathWatcherManager} with a new one that creates [NativeWatchers]{NativeWatcher}
// based on the value of `setting`.
static async transitionTo (setting) {
--
2.17.0