mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-11-24 08:47:04 +08:00
1、实现压缩包的Markdown文件导入
2、重命名文件
This commit is contained in:
@@ -198,4 +198,24 @@ func Round(val float64, places int) float64 {
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
//判断指定目录下是否存在指定后缀的文件
|
||||
func HasFileOfExt(path string,exts []string) bool {
|
||||
err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
|
||||
if !info.IsDir() {
|
||||
|
||||
ext := filepath.Ext(info.Name())
|
||||
|
||||
for _,item := range exts {
|
||||
if strings.EqualFold(ext,item) {
|
||||
return os.ErrExist
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
return err == os.ErrExist
|
||||
}
|
||||
Reference in New Issue
Block a user