 desc = require '../utils/text-description'
+pathM = require 'path'
 {Directory} = require 'atom'
 {$, TextEditorView, View} = require 'atom-space-pen-views'
 

    if @type isnt 'template'
      @parentView.setNextBtn('finish')
    @parentView.disableNext()
    # @appId.setText 'newPackage'
    # @appName.setText '新项目'
    @appPath.setText desc.newProjectDefaultPath

  openFolder: ->
    atom.pickFolder (paths) =>
      if paths[0]?
        console.log paths[0]
        path = "#{paths[0]}/#{@appId.getText()}".replace(/\\/g,'/')
        console.log  path
        @appPath.setText path

  getElement: ->
    @element

  getProjectInfo: ->
    console.log @appId
    projectInfo =
      appId : @appId.getText();
      appName : @appName.getText();

      @parentView.disableNext()

  setPath: ->
    currPath = @appPath.basePath
    # console.log currPath
    @appPath.setText pathM.join currPath,@appId.getText().trim() if currPath isnt ""
    @checkInput()

  checkPath: ->
    path = @appPath.getText().trim()
    @appPath.basePath = path if @appPath.hasFocus()
    if path isnt ""
      dir = new Directory(path);
      dir.exists()
        .then (isExists) =>
          # console.log isExists,@,dir.getRealPathSync()
          unless isExists
            @checkInput()
            @errorMsg.addClass('hide')
