mirror of
https://github.com/atom/atom.git
synced 2026-02-12 15:45:23 -05:00
Update AtomWindow::projectRoots synchronously on openLocations()
This commit is contained in:
@@ -72,10 +72,7 @@ class AtomWindow extends EventEmitter {
|
||||
if (this.loadSettings.safeMode == null) this.loadSettings.safeMode = false
|
||||
if (this.loadSettings.clearWindowState == null) this.loadSettings.clearWindowState = false
|
||||
|
||||
this.projectRoots = locationsToOpen
|
||||
.filter(location => location.pathToOpen && location.exists && location.isDirectory)
|
||||
.map(location => location.pathToOpen)
|
||||
this.projectRoots.sort()
|
||||
this.addLocationsToOpen(locationsToOpen)
|
||||
|
||||
this.loadSettings.hasOpenFiles = locationsToOpen
|
||||
.some(location => location.pathToOpen && !location.isDirectory)
|
||||
@@ -240,6 +237,7 @@ class AtomWindow extends EventEmitter {
|
||||
}
|
||||
|
||||
async openLocations (locationsToOpen) {
|
||||
this.addLocationsToOpen(locationsToOpen)
|
||||
await this.loadedPromise
|
||||
this.sendMessage('open-locations', locationsToOpen)
|
||||
}
|
||||
@@ -252,6 +250,18 @@ class AtomWindow extends EventEmitter {
|
||||
this.sendMessage('did-fail-to-read-user-settings', message)
|
||||
}
|
||||
|
||||
addLocationsToOpen (locationsToOpen) {
|
||||
const roots = new Set(this.projectRoots || [])
|
||||
for (const {pathToOpen, isDirectory} of locationsToOpen) {
|
||||
if (isDirectory) {
|
||||
roots.add(pathToOpen)
|
||||
}
|
||||
}
|
||||
|
||||
this.projectRoots = Array.from(roots)
|
||||
this.projectRoots.sort()
|
||||
}
|
||||
|
||||
replaceEnvironment (env) {
|
||||
this.browserWindow.webContents.send('environment', env)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user