embed.go 827 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2022 The Gogs 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 and LICENSE.gogs file.
  4. // Copyright 2025 Huan-Gogs Authors. All rights reserved.
  5. // Use of this source code is governed by a MIT-style
  6. // license that can be found in the LICENSE file.
  7. package conf
  8. import (
  9. "embed"
  10. )
  11. //go:embed app.ini **/*
  12. var Files embed.FS
  13. // FileNames returns a list of filenames exists in the given direction within
  14. // Files. The list includes names of subdirectories.
  15. func FileNames(dir string) ([]string, error) {
  16. entries, err := Files.ReadDir(dir)
  17. if err != nil {
  18. return nil, err
  19. }
  20. fileNames := make([]string, 0, len(entries))
  21. for _, entry := range entries {
  22. fileNames = append(fileNames, entry.Name())
  23. }
  24. return fileNames, nil
  25. }