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

discover_bindata.go 702B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2020 The Gitea 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. //go:build bindata
  5. // +build bindata
  6. package svg
  7. import (
  8. "path/filepath"
  9. "code.gitea.io/gitea/modules/public"
  10. )
  11. // Discover returns a map of discovered SVG icons in bindata
  12. func Discover() map[string]string {
  13. svgs := make(map[string]string)
  14. for _, file := range public.AssetNames() {
  15. matched, _ := filepath.Match("img/svg/*.svg", file)
  16. if matched {
  17. content, err := public.Asset(file)
  18. if err == nil {
  19. filename := filepath.Base(file)
  20. svgs[filename[:len(filename)-4]] = string(content)
  21. }
  22. }
  23. }
  24. return svgs
  25. }