pathutil

package
v0.0.0-...-d4f15c7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathutil provides some simple path related functions. Before using, please check the standard library's path and path/filepath functions to see if there is something more appropraite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSlash

func AppendSlash(s string) string

AppendSlash appends a slash, `/`, to the end of the passed string, if it doesn't already end with one. For OS independend filepaths, `/` are always used internally with OS-specific conversion occuring before interacting with the filesystem via filepath.FromSlash() and filepath.ToSlash()

func PathExists

func PathExists(p string) (bool, error)

PathExists returns true if the given path exists, otherwise false. If an error is encountered, that is returned, otherwise error will be nil.

Since it not existing will cause an os.Stat error, we need to check if the error passed back is the IsNotExist error, which would mean the path does not exist, instead of an ectual error state.

Types

type Dir

type Dir struct {
	Files []file
}

Dir is a container for a list of filenames in a directory.

func (*Dir) Walk

func (d *Dir) Walk(path string) error

Walk walks the passed path, making a list of all the files that are children of the path.

Jump to

Keyboard shortcuts

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