You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

path.go 391 B

2 years ago
2 years ago
123456789101112131415161718192021222324252627282930
  1. package util
  2. import (
  3. "io/ioutil"
  4. "os"
  5. )
  6. func FileExist(path string) bool {
  7. if _, err := os.Stat(path); os.IsNotExist(err) {
  8. return false
  9. }
  10. return true
  11. }
  12. func ListFiles(path string) []string {
  13. res := []string{}
  14. files, err := ioutil.ReadDir(path)
  15. if err != nil {
  16. panic(err)
  17. }
  18. for _, f := range files {
  19. if !f.IsDir() {
  20. res = append(res, f.Name())
  21. }
  22. }
  23. return res
  24. }

No Description

Contributors (1)