package fsutil

import (
	
	
	
	

	
)

// DontSearch determines whether the path to an external command should be
// taken literally and not searched.
func ( string) bool {
	return  == ".." || strings.ContainsRune(, filepath.Separator) ||
		strings.ContainsRune(, '/')
}

// IsExecutable determines whether path refers to an executable file.
func ( string) bool {
	,  := os.Stat()
	if  != nil {
		return false
	}
	 := .Mode()
	return !.IsDir() && (&0111 != 0)
}

// EachExternal calls f for each name that can resolve to an external command.
//
// BUG: EachExternal may generate the same command multiple command it it
// appears in multiple directories in PATH.
//
// BUG: EachExternal doesn't work on Windows since it relies on the execution
// permission bit, which doesn't exist on Windows.
func ( func(string)) {
	for ,  := range searchPaths() {
		// TODO(xiaq): Ignore error.
		,  := ioutil.ReadDir()
		for ,  := range  {
			if !.IsDir() && (.Mode()&0111 != 0) {
				(.Name())
			}
		}
	}
}

func () []string {
	return strings.Split(os.Getenv(env.PATH), ":")
}