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//go:build unix || (js && wasm) || wasip1 6 7package filepath 8 9import ( 10 "strings" 11) 12 13// HasPrefix exists for historical compatibility and should not be used. 14// 15// Deprecated: HasPrefix does not respect path boundaries and 16// does not ignore case when required. 17func HasPrefix(p, prefix string) bool { 18 return strings.HasPrefix(p, prefix) 19} 20 21func splitList(path string) []string { 22 if path == "" { 23 return []string{} 24 } 25 return strings.Split(path, string(ListSeparator)) 26} 27 28func abs(path string) (string, error) { 29 return unixAbs(path) 30} 31 32func join(elem []string) string { 33 // If there's a bug here, fix the logic in ./path_plan9.go too. 34 for i, e := range elem { 35 if e != "" { 36 return Clean(strings.Join(elem[i:], string(Separator))) 37 } 38 } 39 return "" 40} 41 42func sameWord(a, b string) bool { 43 return a == b 44} 45