Documentation ¶
Index ¶
- func AllExt(path string) string
- func ChangeParent(srcPath string, srcDir string, dstDir string) (dstPath string, err error)
- func MustChangeParent(srcPath string, srcDir string, dstDir string) string
- func RemoveAllExt(path string) string
- func RemoveExt(path string) string
- func ReplaceAllExt(path string, ext string) string
- func ReplaceExt(path string, ext string) string
- func Splits(path string) (parts []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllExt ¶ added in v0.11.0
AllExt returns all extensions (e.g., ".tar.gz" instead of ".gz") from the file name (including ".").
func ChangeParent ¶ added in v0.10.0
ChangeParent changes the parent of srcPath from srcDir to dstDir, and returns the dstPath. If srcPath is not a child of srcDir, it returns an error.
For example
ChangeParent("/home/user/dir/file.txt", "/home", "/root") // -> "/root/user/dir/file.txt" ChangeParent("/home/user/file.txt", "/home/user", "/home/user/dir") // -> "/home/user/dir/file.txt"
func MustChangeParent ¶ added in v0.10.0
MustChangeParent calls ChangeParent and panics if an error occurs. It is safe to use MustChangeParent in, for example, os.WalkDir.
func RemoveAllExt ¶ added in v0.10.0
RemoveAllExt returns the path without all extensions.
func ReplaceAllExt ¶ added in v0.10.0
ReplaceAllExt replaces all extensions of the given path with the given extension.
func ReplaceExt ¶
ReplaceExt replaces the extension of the given path with the given extension.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.