|
1 |
| -// Copyright 2016 The Gitea Authors. All rights reserved. |
| 1 | +// Copyright 2022 The Gitea Authors. All rights reserved. |
2 | 2 | // Use of this source code is governed by a MIT-style
|
3 | 3 | // license that can be found in the LICENSE file.
|
4 | 4 |
|
@@ -32,24 +32,23 @@ func Dir(name string) ([]string, error) {
|
32 | 32 | customDir := path.Join(setting.CustomPath, "options", name)
|
33 | 33 | isDir, err := util.IsDir(customDir)
|
34 | 34 | if err != nil {
|
35 |
| - return []string{}, fmt.Errorf("Failed to check if custom directory %s is a directory. %v", err) |
| 35 | + return []string{}, fmt.Errorf("unable to check if custom directory %q is a directory. %w", customDir, err) |
36 | 36 | }
|
37 | 37 | if isDir {
|
38 | 38 | files, err := util.StatDir(customDir, true)
|
39 | 39 | if err != nil {
|
40 |
| - return []string{}, fmt.Errorf("Failed to read custom directory. %v", err) |
| 40 | + return []string{}, fmt.Errorf("unable to read custom directory %q. %w", customDir, err) |
41 | 41 | }
|
42 | 42 |
|
43 | 43 | result = append(result, files...)
|
44 | 44 | }
|
45 | 45 |
|
46 | 46 | files, err := AssetDir(name)
|
47 | 47 | if err != nil {
|
48 |
| - return []string{}, fmt.Errorf("Failed to read embedded directory. %v", err) |
| 48 | + return []string{}, fmt.Errorf("unable to read embedded directory %q. %w", name, err) |
49 | 49 | }
|
50 | 50 |
|
51 | 51 | result = append(result, files...)
|
52 |
| - |
53 | 52 | return directories.AddAndGet(name, result), nil
|
54 | 53 | }
|
55 | 54 |
|
|
0 commit comments