       @message "cwd: #{@cwd}"
 
   ls: (args)->
-    files = fs.readdirSync @cwd
+    files = fs.readdirSync @getCwd()
     filesBlocks = []
     files.forEach (filename) =>
-      filesBlocks.push @_fileInfoHtml(filename, @cwd)
+      filesBlocks.push @_fileInfoHtml(filename, @getCwd())
     filesBlocks = filesBlocks.sort (a, b)->
       aDir = a[1].isDirectory()
       bDir = b[1].isDirectory()

      @open()

  cd: (args)->
    dir = resolve @cwd, args[0]
    fs.stat dir, (err, stat) =>
      if err
        if err.code == 'ENOENT'

    removeClass @statusIcon, 'status-success'
    addClass @statusIcon, 'status-error'

  getCwd: ()->
    @cwd or atom.project.path or @userHome

  spawn: (cmd, args) ->
    @cmdEditor.hide()
    htmlStream = ansihtml()
