Finish the delete and sync by physics.

This commit is contained in:
lishuang
2020-07-11 19:56:13 +08:00
parent f16d48b432
commit 7fe673068b
5 changed files with 165 additions and 10 deletions

View File

@ -243,3 +243,22 @@ func UniformPath(p string) string {
p = strings.TrimSuffix(p, "/")
return p
}
// readDirNames reads the directory named by dirname and returns
// see filepath.readDirNames
func ReadDirNames(dirname string) ([]string, error) {
f, err := os.Open(dirname)
if err != nil {
return nil, err
}
names, err := f.Readdirnames(-1)
if err != nil {
return nil, err
}
err = f.Close()
if err != nil {
return nil, err
}
return names, nil
}