server: go.chromium.org/goma/server/command/descriptor/winpath Index | Files

package winpath

import "go.chromium.org/goma/server/command/descriptor/winpath"

Package winpath handles windows-path (backslash separated path). It also accepts slash as path separator.

Index

Package Files

winpath.go

func Base Uses

func Base(fname string) string

Base returns the last element of fname. If fname is empty, or ends with path separator, Base returns ".". If fname is `\` only, Base returns `\`.

func Clean Uses

func Clean(path string) string

Clean returns the shortest path name equivalent to path by purely lexical processing.

func Dir Uses

func Dir(fname string) string

Dir returns all but the last element of path, typically the path's directory. Differnt from filepath.Dir, it won't clean ".." in the result. If path is empty, Dir returns ".".

func IsAbs Uses

func IsAbs(fname string) bool

IsAbs returns true if fname is absolute path.

func Join Uses

func Join(elem ...string) string

Join joins any number of path elements into a single path, adding a "/" if necessary. Different from filepath.Join, it won't clean ".." in the result. All empty strings are ignored.

func Rel Uses

func Rel(basepath, targpath string) (string, error)

Rel returns a relative path that is lexically equivalent to targpath when joined to basepath with an intervening separator. TODO: case insensitive match.

func SplitElem Uses

func SplitElem(fname string) []string

SplitElem splits path into element, separated by `\` or "/". If fname is absolute path, first element is `\` or `<drive>:\`, otherwise if fname has drive, first element is `<drive>:`. If fname ends with `\` or `\.`, last element is ".". Empty string, "/", `\` or "." won't be appeared in other elements.

type FilePath Uses

type FilePath struct{}

FilePath provides win filepath.

func (FilePath) Base Uses

func (FilePath) Base(path string) string

func (FilePath) Clean Uses

func (FilePath) Clean(path string) string

func (FilePath) Dir Uses

func (FilePath) Dir(path string) string

func (FilePath) IsAbs Uses

func (FilePath) IsAbs(path string) bool

func (FilePath) Join Uses

func (FilePath) Join(elem ...string) string

func (FilePath) PathSep Uses

func (FilePath) PathSep() string

func (FilePath) Rel Uses

func (FilePath) Rel(basepath, targpath string) (string, error)

func (FilePath) SplitElem Uses

func (FilePath) SplitElem(path string) []string

Package winpath imports 4 packages (graph) and is imported by 2 packages. Updated 2019-05-20. Refresh now. Tools for package owners.