Source file src/internal/safefilepath/path.go

     1  // Copyright 2022 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 safefilepath manipulates operating-system file paths.
     6  package safefilepath
     7  
     8  import (
     9  	"errors"
    10  )
    11  
    12  var errInvalidPath = errors.New("invalid path")
    13  
    14  // FromFS converts a slash-separated path into an operating-system path.
    15  //
    16  // FromFS returns an error if the path cannot be represented by the operating
    17  // system. For example, paths containing '\' and ':' characters are rejected
    18  // on Windows.
    19  func FromFS(path string) (string, error) {
    20  	return fromFS(path)
    21  }
    22  

View as plain text