mirror of
https://github.com/atom/atom.git
synced 2026-01-25 14:59:03 -05:00
Fixes #13729 Previously, when adding a window, we were unable to read its current project paths out of the hash of the URL during window initialization because the window still considered itself to be loading. Rather than fixing this issue, we decided to completely eliminate the sharing of state between processes in the window.location and instead switch to cached synchronous RPC for the loadSettings and a dedicated RPC-based mechanism for the project paths.
44 lines
1.5 KiB
CoffeeScript
44 lines
1.5 KiB
CoffeeScript
# Like sands through the hourglass, so are the days of our lives.
|
|
module.exports = ({blobStore}) ->
|
|
{updateProcessEnv} = require('./update-process-env')
|
|
path = require 'path'
|
|
require './window'
|
|
getWindowLoadSettings = require './get-window-load-settings'
|
|
{ipcRenderer} = require 'electron'
|
|
{resourcePath, devMode, env} = getWindowLoadSettings()
|
|
require './electron-shims'
|
|
|
|
# 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'
|
|
Clipboard = require './clipboard'
|
|
TextEditor = require './text-editor'
|
|
|
|
clipboard = new Clipboard
|
|
TextEditor.setClipboard(clipboard)
|
|
|
|
window.atom = new AtomEnvironment({
|
|
window, document, clipboard, blobStore,
|
|
applicationDelegate: new ApplicationDelegate,
|
|
configDirPath: process.env.ATOM_HOME,
|
|
enablePersistence: true,
|
|
env: process.env
|
|
})
|
|
|
|
atom.startEditorWindow().then ->
|
|
# Workaround for focus getting cleared upon window creation
|
|
windowFocused = ->
|
|
window.removeEventListener('focus', windowFocused)
|
|
setTimeout (-> document.querySelector('atom-workspace').focus()), 0
|
|
window.addEventListener('focus', windowFocused)
|
|
ipcRenderer.on('environment', (event, env) ->
|
|
updateProcessEnv(env)
|
|
)
|