mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
File -> Open works without open windows
This commit is contained in:
committed by
David Wilson
parent
6696731fd5
commit
bed9c6966e
@@ -23,6 +23,20 @@ const ConfigSchema = require('../config-schema')
|
||||
|
||||
const LocationSuffixRegExp = /(:\d+)(:\d+)?$/
|
||||
|
||||
const getDefaultPath = () => {
|
||||
const editor = atom.workspace.getActiveTextEditor()
|
||||
if (!editor) {
|
||||
return undefined
|
||||
}
|
||||
if (!editor.getPath()) {
|
||||
return undefined
|
||||
}
|
||||
const paths = atom.project.getPaths()
|
||||
if (paths) {
|
||||
return paths[0]
|
||||
}
|
||||
}
|
||||
|
||||
// The application's singleton class.
|
||||
//
|
||||
// It's the entry point into the Atom application and maintains the global state
|
||||
@@ -371,6 +385,9 @@ class AtomApplication extends EventEmitter {
|
||||
this.on('application:new-file', () => (this.focusedWindow() || this).openPath())
|
||||
this.on('application:open-dev', () => this.promptForPathToOpen('all', {devMode: true}))
|
||||
this.on('application:open-safe', () => this.promptForPathToOpen('all', {safeMode: true}))
|
||||
this.on('application:open', () => this.promptForPathToOpen('all', getLoadSettings(), getDefaultPath()))
|
||||
this.on('application:open-file', () => this.promptForPathToOpen('file', getLoadSettings(), getDefaultPath()))
|
||||
this.on('application:open-folder', () => this.promptForPathToOpen('file', getLoadSettings(), getDefaultPath()))
|
||||
this.on('application:inspect', ({x, y, atomWindow}) => {
|
||||
if (!atomWindow) atomWindow = this.focusedWindow()
|
||||
if (atomWindow) atomWindow.browserWindow.inspectElement(x, y)
|
||||
|
||||
Reference in New Issue
Block a user