path_plan9.mx raw

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