Documentation ¶
Index ¶
- Variables
- func AppendFile(path string, content []byte) (err error)
- func CopyFile(src, dst string) (err error)
- func Delete(path string) (err error)
- func FileExist(path string) (exist bool, err error)
- func FullPathOnPath(workingPath string, path string) string
- func GetAllFiles(root string) (out []string, err error)
- func GetExt(path string) string
- func GetFileBaseWithoutExt(p string) string
- func HasExt(path string, ext string) bool
- func IsDotFile(path string) bool
- func Mkdir(path string) (err error)
- func MkdirForFile(path string) (err error)
- func MustAppendFile(path string, content []byte)
- func MustAppendFileAddLineEnd(path string, content []byte)
- func MustChangeToTmpPath() string
- func MustCopyFile(src, dst string)
- func MustCopyFileIgnoreNotExist(src, dst string)
- func MustDelete(path string)
- func MustDeleteFile(path string)
- func MustDeleteFileOrDirectory(path string)
- func MustDirectoryExist(path string) bool
- func MustEnsureBinPath(finalPath string)
- func MustFileExist(path string) bool
- func MustGetAllDir(root string) (out []string)
- func MustGetAllFileFromPathList(pathlist []string) (outList []string)
- func MustGetAllFileOneLevel(path string) (fileList []string)
- func MustGetAllFiles(root string) (out []string)
- func MustGetWd() string
- func MustMkdir(dirname string)
- func MustMkdirAll(dirname string)
- func MustMkdirForFile(path string)
- func MustReadDirFileOneLevel(path string) (fileList []string)
- func MustReadFile(path string) (content []byte)
- func MustReadFileAll(path string) (content []byte)
- func MustReadSymbolLink(inPath string) string
- func MustRealPath(inPath string) string
- func MustRename(oldpath string, newpath string)
- func MustSymlink(fromPath string, toPath string)
- func MustWriteFile(path string, content []byte)
- func MustWriteFileWithMkdir(path string, content []byte)
- func NewTmpFilePath() string
- func PathBaseWithoutExt(path string) string
- func PathTrimExt(path string) string
- func ReadDir(dirname string) ([]os.FileInfo, error)
- func ReadDirFileOneLevel(path string) (fileList []string, err error)
- func ReadFile(path string) (content []byte, err error)
- func ReadFileAll(path string) (content []byte, err error)
- func Realpath(inPath string) (string, error)
- func RemoveExtFromFilePath(path string) string
- func SearchFileInParentDir(startDirPath string, fileName string) (file string, err error)
- func TailByte(filePath string, size int64) (content []byte)
- func WriteFile(path string, content []byte) (err error)
- type DirectoryFileTransform
- type PathAndContentPair
- type StatAndFullPath
Constants ¶
This section is empty.
Variables ¶
var NotFoundError = errors.New("Not found")
Functions ¶
func AppendFile ¶
func CopyFile ¶
拷贝文件 不能拷贝目录 如果目标文件存在,直接覆盖 如果目标文件的文件夹不存在,创建文件夹,然后再拷贝 copy file can not copy directory * override dst file if it exist, * mkdir if base dir not exist from http://stackoverflow.com/a/21067803/1586797
func FullPathOnPath ¶
使用workingPath把path更新为全路径
func GetFileBaseWithoutExt ¶
func MustAppendFile ¶
func MustChangeToTmpPath ¶
func MustChangeToTmpPath() string
func MustCopyFile ¶
func MustCopyFile(src, dst string)
func MustCopyFileIgnoreNotExist ¶
func MustCopyFileIgnoreNotExist(src, dst string)
拷贝文件,把文件从src拷贝到dst 如果源文件不存在,不报错
func MustDeleteFile ¶
func MustDeleteFile(path string)
delete file,ignore file not exist err @deprecated use MustDelete instead
func MustDeleteFileOrDirectory ¶
func MustDeleteFileOrDirectory(path string)
@deprecated use MustDelete instead
func MustDirectoryExist ¶
目录是否存在,如果不存在会返回false,如果存在但是不是目录,会返回false 其他此处无法预料的错误会panic TODO 解决名称歧义问题.
func MustEnsureBinPath ¶
func MustEnsureBinPath(finalPath string)
func MustFileExist ¶
func MustGetAllFileFromPathList ¶
获得所有文件,不包括目录
func MustGetAllFileOneLevel ¶
只返回这个目录额一层文件. 获得所有文件,不包括目录 返回绝对路径
func MustMkdirForFile ¶
func MustMkdirForFile(path string)
func MustReadDirFileOneLevel ¶
func MustReadFile ¶
func MustReadFileAll ¶
@deprecated use MustReadFile instead
func MustReadSymbolLink ¶
func MustRealPath ¶
func MustRename ¶
func MustSymlink ¶
func MustWriteFile ¶
func MustWriteFileWithMkdir ¶
func PathBaseWithoutExt ¶
返回文件名部分但是不带扩展名 如果没有扩展名就不变了. 有多个扩展名,就删除一个.
func PathTrimExt ¶
func ReadDirFileOneLevel ¶
返回一个目录下面的所有文件的名字 文件名是相对于这个目录的 只返回第一层,没有更多层 只返回文件,不返回目录
func ReadFileAll ¶
@deprecated use ReadFile instead
func RemoveExtFromFilePath ¶
func SearchFileInParentDir ¶
向上搜索某个目录下面的某个文件 比如搜索 .git 目录 搜索 .kmg.yml 文件 返回 .git 所在的上级目录.
Types ¶
type DirectoryFileTransform ¶
type PathAndContentPair ¶
type StatAndFullPath ¶
func GetAllFileAndDirectoryStat ¶
func GetAllFileAndDirectoryStat(root string) (out []StatAndFullPath, err error)
获取这个路径的所有文件的状态和完整路径
如果输入是一个文件,则返回这个文件的完整路径 如果输入是一个目录,则返回这个目录和下面所有目录和文件的信息和完整路径 目前暂不明确symlink的文件会如何处理