path

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPath = errors.New("invalid path")
View Source
var ErrPathAlreadyExist = errors.New("path already exist")
View Source
var ErrPathNoExist = errors.New("path no exist")

Functions

func EnsurePathExist

func EnsurePathExist(path string) (bool, error)

EnsurePathExist 确认文件或文件夹是否存在

func JoinPath added in v1.1.9

func JoinPath(paths ...string) string

JoinPath 路径拼接

func MakeDir

func MakeDir(path string, existReturnError bool) (err error)

MakeDir 创建单一目录, 不支持创建多级目录 path 路径 exist_no_error 路径已存在时是否返回错误

func MakeDirIfNotPresent

func MakeDirIfNotPresent(path string) error

MakeDirIfNotPresent 目录不存在, 则创建; 存在则不操作 path 路径

func MakeDirs

func MakeDirs(path ...string) error

MakeDirs 创建多级目录

func PathSplit

func PathSplit(path string) (string, string)

PathSplit 路径分割, 返回目录以及文件名

func Relative2Abs

func Relative2Abs(relativePath string) (string, error)

Relative2Abs 相对路径转化绝对路径

func RemovePath

func RemovePath(path string, noExistReturnError bool) (bool, error)

RemovePath 完全删除文件夹或文件, 对于文件夹包括子文件以及子文件夹 path 路径 noExistReturnError 路径不存在时是否返回错误

Types

This section is empty.

Jump to

Keyboard shortcuts

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