-_       = require("lodash")
-cp      = require("child_process")
-os      = require("os")
-fs      = require("fs-extra")
-path    = require("path")
-chalk   = require("chalk")
-Xvfb    = require("xvfb")
-Promise = require("bluebird")
+_        = require("lodash")
+cp       = require("child_process")
+os       = require("os")
+fs       = require("fs-extra")
+path     = require("path")
+chalk    = require("chalk")
+Xvfb     = require("xvfb")
+userhome = require("userhome")
+Promise  = require("bluebird")
 
 fs   = Promise.promisifyAll(fs)
 xvfb = Promise.promisifyAll(new Xvfb({silent: true}))


  getPlatformExecutable: ->
    switch p = os.platform()
      when "darwin" then "Cypress.app/Contents/MacOS/cypress"
      when "linux"  then "Cypress"
      when "win32"  then "Cypress.exe"
      else
        throw new Error("Platform: '#{p}' is not supported.")

  getDefaultAppFolder: ->
    switch p = os.platform()
      when "darwin" then "/Applications"
      when "linux"  then "/usr/local/bin"
      # when "win32"   then "i/dont/know/yet"
      else
        throw new Error("Platform: '#{p}' is not supported.")

      console.log("")
      process.exit(1)

  stopXvfb: ->
    xvfb.stopAsync()

  spawn: (args, options = {}) ->
    ## this needs to change to become async and
    ## to do a lookup for the cached cypress path
