1
0

embed.go 647 B

123456789101112131415161718192021222324252627
  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 file.
  4. package conf
  5. import (
  6. "embed"
  7. )
  8. //go:embed app.ini **/*
  9. var Files embed.FS
  10. // FileNames returns a list of filenames exists in the given direction within
  11. // Files. The list includes names of subdirectories.
  12. func FileNames(dir string) ([]string, error) {
  13. entries, err := Files.ReadDir(dir)
  14. if err != nil {
  15. return nil, err
  16. }
  17. fileNames := make([]string, 0, len(entries))
  18. for _, entry := range entries {
  19. fileNames = append(fileNames, entry.Name())
  20. }
  21. return fileNames, nil
  22. }