blob: 7af82050d46b5682376db015717d8d97201bd0bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
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
|