diff --git a/src/window-bootstrap.coffee b/src/window-bootstrap.coffee index 60a9a14d5..886ba26dc 100644 --- a/src/window-bootstrap.coffee +++ b/src/window-bootstrap.coffee @@ -1,14 +1,3 @@ -# Ensure ATOM_HOME is always set before anything else is required -unless process.env.ATOM_HOME - if process.platform is 'win32' - home = process.env.USERPROFILE - else - home = process.env.HOME - atomHome = path.join(home, '.atom') - try - atomHome = require('fs').realpathSync(atomHome) - process.env.ATOM_HOME = atomHome - # Like sands through the hourglass, so are the days of our lives. require './window' diff --git a/static/index.js b/static/index.js index 12b149699..e5f84f794 100644 --- a/static/index.js +++ b/static/index.js @@ -13,6 +13,23 @@ window.onload = function() { var fs = require('fs'); var path = require('path'); + // Ensure ATOM_HOME is always set before anything else is required + if (!process.env.ATOM_HOME) { + var home; + if (process.platform === 'win32') { + home = process.env.USERPROFILE; + } else { + home = process.env.HOME; + } + var atomHome = path.join(home, '.atom'); + try { + atomHome = fs.realpathSync(atomHome); + } catch (error) { + // Ignore since the path might just not exist yet. + } + process.env.ATOM_HOME = atomHome; + } + // Skip "?loadSettings=". var rawLoadSettings = decodeURIComponent(location.search.substr(14)); var loadSettings;