dir.go 476 B

12345678910111213141516171819202122232425
  1. // Copyright 2025 BackendServerTemplate Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package filesystemutils
  5. import "os"
  6. func IsDir(path string) bool {
  7. s, err := os.Stat(path)
  8. if err != nil {
  9. return false
  10. }
  11. return s.IsDir()
  12. }
  13. func IsExistsAndDir(path string) (exists, isDir bool) {
  14. s, err := os.Stat(path)
  15. if err != nil {
  16. return false, false
  17. }
  18. return true, s.IsDir()
  19. }