 
 setupAtomHome = ->
   return if process.env.ATOM_HOME
+
+  # Use install-relative .atom path on Windows when using the installer version
+  # in a non-default version. This enables an easy portable version.
+  if process.platform is 'win32'
+    SquirrelUpdate = require './squirrel-update'
+    if SquirrelUpdate.existsSync()
+      atomPath = path.join(process.env.LOCALAPPDATA, 'atom').toLowerCase()
+      if __dirname.toLowerCase().indexOf(atomPath) isnt 0
+        process.env.ATOM_HOME = path.join(rootAtomFolder, '.atom')
+        return
 
   if process.platform is 'win32'
     home = process.env.USERPROFILE

  nslog(error.stack) if error.stack?

start = ->
  if process.platform is 'win32'
    SquirrelUpdate = require './squirrel-update'
    squirrelCommand = process.argv[1]


  {resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile}

start()
