path

package
v0.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirFile

type DirFile struct {
	Dir  string
	File string
}

DirFile holds the result from path.Split.

func (DirFile) String

func (df DirFile) String() string

Used in test.

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace provides template functions for the "os" namespace.

func New

func New(deps *deps.Deps) *Namespace

New returns a new instance of the path-namespaced template functions.

func (*Namespace) Join

func (ns *Namespace) Join(elements ...interface{}) (string, error)

Join joins any number of path elements into a single path, adding a separating slash if necessary. All the input path elements are passed into filepath.ToSlash converting any Windows slashes to forward slashes. The result is Cleaned; in particular, all empty strings are ignored.

func (*Namespace) Split

func (ns *Namespace) Split(path interface{}) (DirFile, error)

Split splits path immediately following the final slash, separating it into a directory and file name component. If there is no slash in path, Split returns an empty dir and file set to path. The input path is passed into filepath.ToSlash converting any Windows slashes to forward slashes. The returned values have the property that path = dir+file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL