add leaui_image plugin for replace leanote_image. on a train to ChangSha

This commit is contained in:
life
2014-06-28 23:07:34 +08:00
parent 06eb27faab
commit 1494b25129
15 changed files with 369 additions and 12 deletions

View File

@ -30,6 +30,16 @@ func GetFilename(path string) string {
return filepath.Base(path)
}
// file size
// length in bytes
func GetFilesize(path string) int64 {
fileinfo, err := os.Stat(path)
if err == nil {
return fileinfo.Size()
}
return 0;
}
// 清空dir下所有的文件和文件夹
// RemoveAll会清空本文件夹, 所以还要创建之
func ClearDir(dir string) bool {
@ -42,4 +52,14 @@ func ClearDir(dir string) bool {
return false
}
return true
}
// list dir's all file, return filenames
func ListDir(dir string) []string {
f, err := os.Open(dir)
if err != nil {
return nil
}
names, _ := f.Readdirnames(0)
return names
}