summaryrefslogtreecommitdiffstats
path: root/modules/templates/static.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/templates/static.go')
-rw-r--r--modules/templates/static.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/templates/static.go b/modules/templates/static.go
index 3265bd9cfc..7f7cbe702f 100644
--- a/modules/templates/static.go
+++ b/modules/templates/static.go
@@ -31,6 +31,18 @@ func GlobalModTime(filename string) time.Time {
return timeutil.GetExecutableModTime()
}
+// GetAssetFilename returns the filename of the provided asset
+func GetAssetFilename(name string) (string, error) {
+ filename := filepath.Join(setting.CustomPath, name)
+ _, err := os.Stat(filename)
+ if err != nil && !os.IsNotExist(err) {
+ return name, err
+ } else if err == nil {
+ return filename, nil
+ }
+ return "(builtin) " + name, nil
+}
+
// GetAsset get a special asset, only for chi
func GetAsset(name string) ([]byte, error) {
bs, err := os.ReadFile(filepath.Join(setting.CustomPath, name))