package util

// TODO rename package update/optimize functions

import (
	
	
	
	
	
	
)

// FindReverse traverses the filetree upwards to find given file/directory.
func ( string,  string) ( string,  error) {
	var  string
	if ,  = filepath.Abs();  == nil {
		 =  + "/" + 
		if _,  = os.Stat();  != nil {
			 := filepath.Dir()
			if  !=  {
				return (, )
			} else {
				 = errors.New("could not find: " + )
			}
		}
	}
	return
}

// HasPathPrefix checks if given string has a path prefix.
func ( string) bool {
	return strings.HasPrefix(, ".") ||
		strings.HasPrefix(, "/") ||
		strings.HasPrefix(, "~") ||
		HasVolumePrefix()
}

// HasVolumePrefix checks if given path has a volume prefix (only for GOOS=windows).
func ( string) bool {
	switch {
	case runtime.GOOS != "windows":
		return false
	case len() < 2:
		return false
	case unicode.IsLetter(rune([0])) && [1] == ':':
		return true
	default:
		return false
	}
}