标准库path/filepath中提供了对各个操作系统文件路径的操作函数,一般情况下不要使用path,因为package path 只兼容以/
为路径分隔符的系统
方法使用
func IsAbs(path string) bool
该函数以路径为参数,如果该路径为绝对路径,那么返回true,如果不是返回false
func Abs(path string) (string, error)
// Abs returns an absolute representation of path.
// If the path is not absolute it will be joined with the current
// working directory to turn it into an absolute path. The absolute
// path name for a given file is not guaranteed to be unique.
// Abs calls Clean on the result.
func Abs(path string) (string, error) {
return abs(path)
}
func unixAbs(path string)