code.gitea.io/gitea@v1.22.3/modules/options/base.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package options
     5  
     6  import (
     7  	"code.gitea.io/gitea/modules/assetfs"
     8  	"code.gitea.io/gitea/modules/setting"
     9  )
    10  
    11  func CustomAssets() *assetfs.Layer {
    12  	return assetfs.Local("custom", setting.CustomPath, "options")
    13  }
    14  
    15  func AssetFS() *assetfs.LayeredFS {
    16  	return assetfs.Layered(CustomAssets(), BuiltinAssets())
    17  }
    18  
    19  // Locale reads the content of a specific locale from static/bindata or custom path.
    20  func Locale(name string) ([]byte, error) {
    21  	return AssetFS().ReadFile("locale", name)
    22  }
    23  
    24  // Readme reads the content of a specific readme from static/bindata or custom path.
    25  func Readme(name string) ([]byte, error) {
    26  	return AssetFS().ReadFile("readme", name)
    27  }
    28  
    29  // Gitignore reads the content of a gitignore locale from static/bindata or custom path.
    30  func Gitignore(name string) ([]byte, error) {
    31  	return AssetFS().ReadFile("gitignore", name)
    32  }
    33  
    34  // License reads the content of a specific license from static/bindata or custom path.
    35  func License(name string) ([]byte, error) {
    36  	return AssetFS().ReadFile("license", name)
    37  }
    38  
    39  // Labels reads the content of a specific labels from static/bindata or custom path.
    40  func Labels(name string) ([]byte, error) {
    41  	return AssetFS().ReadFile("label", name)
    42  }