Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions modules/options/static.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016 The Gitea Authors. All rights reserved.
// Copyright 2016-2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -32,24 +32,23 @@ func Dir(name string) ([]string, error) {
customDir := path.Join(setting.CustomPath, "options", name)
isDir, err := util.IsDir(customDir)
if err != nil {
return []string{}, fmt.Errorf("Failed to check if custom directory %s is a directory. %v", err)
return []string{}, fmt.Errorf("failed to check if custom directory %s is a directory. %w", customDir, err)
}
if isDir {
files, err := util.StatDir(customDir, true)
if err != nil {
return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
return []string{}, fmt.Errorf("failed to read custom directory %s. %w", customDir, err)
}

result = append(result, files...)
}

files, err := AssetDir(name)
if err != nil {
return []string{}, fmt.Errorf("Failed to read embedded directory. %v", err)
return []string{}, fmt.Errorf("failed to read embedded directory %s. %w", name, err)
}

result = append(result, files...)

return directories.AddAndGet(name, result), nil
}

Expand Down