Esempio n. 1
0
func DetectFiles(root string, cmd string) []string {
	regexp, err := regexp.Compile("(" + EscapeRegexp(root) + "/[^ ;&|\"']*)")
	if err != nil {
		log.Println("regexp error", err)
	}

	names := regexp.FindAllString(cmd, -1)
	return names
}
Esempio n. 2
0
File: misc.go Progetto: lht/termite
func DetectFiles(root string, cmd string) []string {
	regexp, err := regexp.Compile("(" + EscapeRegexp(root) + "/[^ ;&|\"']*)")
	if err != nil {
		log.Println("regexp error", err)
	}

	names := []string{}
	matches := regexp.FindAllString(cmd, -1)
	for _, m := range matches {
		names = append(names, m)
	}
	return names
}