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 ¶
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 ¶
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.