mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Fixes #9574 Previously, we were storing the project directory paths as the `initialPaths` key in load settings, which were accessed in the browser process by reading the URL hash. However, this URL hash was not always available, subjecting us to timing issues when opening multiple files in the same folder in rapid succession. We now store the project directory paths directly on AtomWindow instances on creation, then RPC changes from the render process to the browser process with a custom code path. Shout out to :airplane::finnadie:’d @as-cii on this for pairing with me.
34 lines
1.1 KiB
CoffeeScript
34 lines
1.1 KiB
CoffeeScript
# Like sands through the hourglass, so are the days of our lives.
|
|
module.exports = ({blobStore}) ->
|
|
path = require 'path'
|
|
require './window'
|
|
{getWindowLoadSettings} = require './window-load-settings-helpers'
|
|
|
|
{resourcePath, isSpec, devMode} = getWindowLoadSettings()
|
|
|
|
# Add application-specific exports to module search path.
|
|
exportsPath = path.join(resourcePath, 'exports')
|
|
require('module').globalPaths.push(exportsPath)
|
|
process.env.NODE_PATH = exportsPath
|
|
|
|
# Make React faster
|
|
process.env.NODE_ENV ?= 'production' unless devMode
|
|
|
|
AtomEnvironment = require './atom-environment'
|
|
ApplicationDelegate = require './application-delegate'
|
|
window.atom = new AtomEnvironment({
|
|
window, document, blobStore,
|
|
applicationDelegate: new ApplicationDelegate,
|
|
configDirPath: process.env.ATOM_HOME
|
|
enablePersistence: true
|
|
})
|
|
|
|
atom.displayWindow()
|
|
atom.startEditorWindow()
|
|
|
|
# Workaround for focus getting cleared upon window creation
|
|
windowFocused = ->
|
|
window.removeEventListener('focus', windowFocused)
|
|
setTimeout (-> document.querySelector('atom-workspace').focus()), 0
|
|
window.addEventListener('focus', windowFocused)
|