filepath

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: GPL-3.0 Imports: 5 Imported by: 1

README

Go Reference Go Report Card REUSE status Open in Gitpod

Go Utilities: filepath

Go package with utilities that support the work with file paths.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapePattern

func EscapePattern(s string) string

EscapePattern escapes special characters in pattern strings for usage in filepath.Glob() or filepath.Match() See: https://godoc.org/path/filepath#Match

func IsSub

func IsSub(path, sub string) (bool, error)

IsSub returns true if sub is a sub path of path,otherwise false is returned. The function is taken from https://stackoverflow.com/questions/28024731/check-if-given-path-is-a-subdirectory-of-another-in-golang

func PathRelCopy

func PathRelCopy(srcBase, path, dstBase string) (string, error)

PathRelCopy determines first a relative path that is lexically equivalent to path when joined to srcBase with an intervening separator. If this is successful, it returns a path joined from dstBase, a separator and the relative path from the previous step.

func PathTrunk

func PathTrunk(p string) string

PathTrunk returns the file path without the file extension. E.g. Trunk("/home/test/abc.mp3") return "/home/test/abc"

func SplitPath

func SplitPath(path string) []string

SplitPath splits the path of a file into the different folders and files.

func Suffix

func Suffix(f string) string

Suffix returns the suffix of a file without the dot. If the file name contains no dot, an empty string is returned

Types

This section is empty.

Jump to

Keyboard shortcuts

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