Documentation
¶
Index ¶
- Variables
- func AbsPath(file_ string) string
- func Append(src string, data string)
- func ChangeFileType(path string, type_ string) string
- func CmdPath() string
- func Copy(src, dst string) error
- func CopyFile(_src string, dst string)
- func CreatFile(_src string, _data string)
- func Create(src string, data string)
- func DeepDir(path string) ([]string, []string)
- func DeepDirSorted(path string) ([]string, []string)
- func DeleteFile(_src string)
- func Dir(path string) ([]string, []string)
- func ExecutePath() string
- func FileName(file_ string) string
- func FullFileName(file_ string) string
- func IsDir(file_ string) bool
- func IsEmptyDir(path string) bool
- func IsExist(file_ string) bool
- func IsExit(file_ string) bool
- func IsFile(file_ string) bool
- func IsFileType(file string, type_ string) bool
- func ListDir(_src string) (srcNames []string, _dirNames []string)
- func ListDirDeep(_src string) (srcs []string, _folders []string)
- func Move(sourcePath, destPath string) error
- func Read(file string) string
- func ReadAll(_src string) string
- func Remove(src string)
- func SortByDepth(folders []string) []string
- func WslPathConvent(_wslPath string) string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AbsPath ¶
AbsPath 返回文件的绝对路径 移除错误处理 e.g. a.txt -> /home/xxx/a.txt Makefile -> D:/SOFT/CODE/Makefile
func ChangeFileType ¶
将文件类型换为特定类型的文件类型 返回相对路径 不需要带 . 后缀 例如 ChangeFileType("/home/xxx/xxx.go","txt") 返回 /home/xxx/xxx.txt ChangeFileType("xxx","mp4") 返回 xxx.mp4
func CmdPath ¶
func CmdPath() string
获取当前命令窗口的路径 移除错误处理 e.g. CmdPath() -> /home/xxx CmdPath() -> D:/SOFT/CODE
func DeepDirSorted ¶ added in v0.0.26
返回文件夹下的所有 文件 和 文件夹 文件夹按深度排序
func DeleteFile ¶ added in v0.0.28
func DeleteFile(_src string)
func FileName ¶
返回文件名 不包含后缀 对于需要文件名包括后缀 应该使用filepath.Base(file_)方法 例如 /home/bin/xxx.go 返回 xxx test.go 返回 test
func FullFileName ¶
返回文件的文件名 携带前缀的路径 并且一定为绝对路径
例如:/home/xxx/xxx.go 返回 /home/xxx/xxx
test.go 返回 /home/xxx/test
对于path.Dir()方法 区别就是可以对于相对路径也返回它的绝对路径的文件夹路径 需要文件名包括后缀 应该使用filepath.Base(file_)方法
func IsFileType ¶
检查文件类型是否为特定类型 例如 main.go go true main.go txt false
func ListDirDeep ¶ added in v0.0.29
func SortByDepth ¶ added in v0.0.26
func WslPathConvent ¶ added in v0.0.29
cover windows path to wsl path D:\soft\code --> /mnt/d/soft/code
Types ¶
This section is empty.