Source file src/internal/filepathlite/path_unix.go

     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  
     7  package filepathlite
     8  
     9  import (
    10  	"internal/bytealg"
    11  	"internal/stringslite"
    12  )
    13  
    14  const (
    15  	Separator     = '/' // OS-specific path separator
    16  	ListSeparator = ':' // OS-specific path list separator
    17  )
    18  
    19  func IsPathSeparator(c uint8) bool {
    20  	return Separator == c
    21  }
    22  
    23  func isLocal(path string) bool {
    24  	return unixIsLocal(path)
    25  }
    26  
    27  func localize(path string) (string, error) {
    28  	if bytealg.IndexByteString(path, 0) >= 0 {
    29  		return "", errInvalidPath
    30  	}
    31  	return path, nil
    32  }
    33  
    34  // IsAbs reports whether the path is absolute.
    35  func IsAbs(path string) bool {
    36  	return stringslite.HasPrefix(path, "/")
    37  }
    38  
    39  // volumeNameLen returns length of the leading volume name on Windows.
    40  // It returns 0 elsewhere.
    41  func volumeNameLen(path string) int {
    42  	return 0
    43  }
    44  

View as plain text