1 // Copyright 2010 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package filepath 6 7 import "strings" 8 9 // IsAbs reports whether the path is absolute. 10 func IsAbs(path string) bool { 11 return strings.HasPrefix(path, "/") || strings.HasPrefix(path, "#") 12 } 13 14 // volumeNameLen returns length of the leading volume name on Windows. 15 // It returns 0 elsewhere. 16 func volumeNameLen(path string) int { 17 return 0 18 } 19 20 // HasPrefix exists for historical compatibility and should not be used. 21 func HasPrefix(p, prefix string) bool { 22 return strings.HasPrefix(p, prefix) 23 } 24 25 func splitList(path string) []string { 26 if path == "" { 27 return []string{} 28 } 29 return strings.Split(path, string(ListSeparator)) 30 } 31 32 func abs(path string) (string, error) { 33 return unixAbs(path) 34 } 35 36 func join(elem []string) string { 37 // If there's a bug here, fix the logic in ./path_unix.go too. 38 for i, e := range elem { 39 if e != "" { 40 return Clean(strings.Join(elem[i:], string(Separator))) 41 } 42 } 43 return "" 44 } 45