2011-03-24 23:46:17 +00:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2014-07-19 08:53:52 +00:00
|
|
|
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
2011-10-26 23:57:58 +00:00
|
|
|
|
2011-03-24 23:46:17 +00:00
|
|
|
package filepath
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
// IsAbs returns true if the path is absolute.
|
|
|
|
func IsAbs(path string) bool {
|
|
|
|
return strings.HasPrefix(path, "/")
|
|
|
|
}
|
|
|
|
|
2012-10-23 04:31:11 +00:00
|
|
|
// volumeNameLen returns length of the leading volume name on Windows.
|
|
|
|
// It returns 0 elsewhere.
|
|
|
|
func volumeNameLen(path string) int {
|
|
|
|
return 0
|
2011-03-24 23:46:17 +00:00
|
|
|
}
|
2011-09-16 15:47:21 +00:00
|
|
|
|
2012-03-06 17:57:23 +00:00
|
|
|
// HasPrefix exists for historical compatibility and should not be used.
|
2011-09-16 15:47:21 +00:00
|
|
|
func HasPrefix(p, prefix string) bool {
|
|
|
|
return strings.HasPrefix(p, prefix)
|
|
|
|
}
|
2013-07-16 06:54:42 +00:00
|
|
|
|
|
|
|
func splitList(path string) []string {
|
|
|
|
if path == "" {
|
|
|
|
return []string{}
|
|
|
|
}
|
|
|
|
return strings.Split(path, string(ListSeparator))
|
|
|
|
}
|