xfilepath

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package xfilepath defines functions to define path retrievers that support error handling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustInvoke added in v0.27.0

func MustInvoke(p PathRetriever) string

MustInvoke invokes the PathsRetriever func and panics if it returns an error.

Types

type PathRetriever

type PathRetriever func() (path string, err error)

PathRetriever is a function that retrieves the contained path or an error.

func Join

func Join(paths ...PathRetriever) PathRetriever

Join returns a path retriever from the join of the provided path retrievers. The returned path retriever eventually returns the error from the first provided path retrievers that returns a non-nil error.

func JoinFromHome

func JoinFromHome(paths ...PathRetriever) PathRetriever

JoinFromHome returns a path retriever from the join of the user home and the provided path retrievers. The returned path retriever eventually returns the error from the first provided path retrievers that returns a non-nil error.

func Mkdir added in v0.26.0

func Mkdir(path PathRetriever) PathRetriever

Mkdir ensure path exists before returning it.

func Path

func Path(path string) PathRetriever

Path returns a path retriever from the provided path.

func PathWithError

func PathWithError(path string, err error) PathRetriever

PathWithError returns a path retriever from the provided path and error.

type PathsRetriever

type PathsRetriever func() (path []string, err error)

PathsRetriever is a function that retrieves the contained list of paths or an error.

func List

func List(paths ...PathRetriever) PathsRetriever

List returns a paths retriever from a list of path retrievers. The returned paths retriever eventually returns the error from the first provided path retrievers that returns a non-nil error.

Jump to

Keyboard shortcuts

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