-{spawn, exec} = require 'child_process'
+{execFile} = require 'child_process'
 Promise = require 'bluebird'
+Path = require 'path'
 {log, warn, error} = require './logger'
 Stream = require './executable/stream'
 {InvalidExecutablePathError} = require './error'


    # locate the path and see if it is Agda executable
    validateExecutablePath: (path) -> new Promise (resolve, reject) =>
        command = path + ' -V'
        exec command, (error, stdout, stderr) =>
            if /^Agda/.test stdout
                resolve path
            else


    constructor: (@core) ->


    parsePath: (str) ->
        # sanitize by path.parse first
        parsed = Path.parse str
        # join the path back and replace Windows' stupid backslash with slash
        path = Path.join(parsed.dir, parsed.base).split(Path.sep).join('/')
        # fuck Windows Bidi control character
        path = path.substr(1) if path.charCodeAt(0) is 8234
        return path


    getLibraryPath: ->
        path = atom.config.get('agda-mode.libraryPath')
        path.unshift('.')
