mirror of https://github.com/go-gitea/gitea.git
parent
1294f6c511
commit
b001812df4
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -32,12 +32,12 @@ func Dir(name string) ([]string, error) {
|
||||||
customDir := path.Join(setting.CustomPath, "options", name)
|
customDir := path.Join(setting.CustomPath, "options", name)
|
||||||
isDir, err := util.IsDir(customDir)
|
isDir, err := util.IsDir(customDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []string{}, fmt.Errorf("Failed to check if custom directory %s is a directory. %v", err)
|
return []string{}, fmt.Errorf("unable to check if custom directory %q is a directory. %w", customDir, err)
|
||||||
}
|
}
|
||||||
if isDir {
|
if isDir {
|
||||||
files, err := util.StatDir(customDir, true)
|
files, err := util.StatDir(customDir, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
|
return []string{}, fmt.Errorf("unable to read custom directory %q. %w", customDir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, files...)
|
result = append(result, files...)
|
||||||
|
@ -45,11 +45,10 @@ func Dir(name string) ([]string, error) {
|
||||||
|
|
||||||
files, err := AssetDir(name)
|
files, err := AssetDir(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []string{}, fmt.Errorf("Failed to read embedded directory. %v", err)
|
return []string{}, fmt.Errorf("unable to read embedded directory %q. %w", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, files...)
|
result = append(result, files...)
|
||||||
|
|
||||||
return directories.AddAndGet(name, result), nil
|
return directories.AddAndGet(name, result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue