Documentation ¶
Index ¶
- Variables
- func AbsPath(src string) string
- func ChangeFileType(path string, type_ string) string
- func CheckCrossDriverLinux(src, dst string) bool
- func CheckCrossDriverWindows(src, dst string) bool
- func CmdPath() string
- func DeepDir(path string) ([]string, []string)
- func DeepDirSorted(path string) ([]string, []string)
- func Dir(src string) ([]string, []string)
- func ExecutePath() string
- func FileName(src string) string
- func FullFileName(src string) string
- func IsDir(src string) bool
- func IsEmptyDir(src string) bool
- func IsExist(src string) bool
- func IsExit(src string) bool
- func IsFile(src 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 MoveFile(src, dst string) (err error)
- func SortByDepth(folders []string) []string
- func Which(src string) string
- func WslPathConvent(_wslPath string) string
Constants ¶
This section is empty.
Variables ¶
var ( WorkingDirectory = workingDirectory() ExecuteDirectory = executorDirectory() HomeDirectory = os.Getenv("HOME") TempDirectory = os.TempDir() )
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 CheckCrossDriverLinux ¶
func CheckCrossDriverWindows ¶
func CmdPath ¶
func CmdPath() string
获取当前命令窗口的路径 移除错误处理 e.g. CmdPath() -> /home/xxx CmdPath() -> D:/SOFT/CODE
func DeepDirSorted ¶
返回文件夹下的所有 文件 和 文件夹 文件夹按深度排序
func FileName ¶
返回文件名 不包含后缀 对于需要文件名包括后缀 应该使用filepath.Base(src)方法 例如 /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(src)方法
func IsFileType ¶
检查文件类型是否为特定类型 例如 main.go go true main.go txt false
func ListDirDeep ¶
func SortByDepth ¶
func WslPathConvent ¶
cover windows path to wsl path D:\soft\code --> /mnt/d/soft/code
Types ¶
This section is empty.