engine: resources: Avoid double slash on error
Errors will include a second slash if this ends with one. Might as well clean it to avoid the semblance of a bug.
This commit is contained in:
@@ -1815,8 +1815,8 @@ func ReadDir(p string) ([]FileInfo, error) {
|
||||
if !strings.HasSuffix(p, "/") { // dirs have trailing slashes
|
||||
return nil, fmt.Errorf("path must be a directory")
|
||||
}
|
||||
output := []FileInfo{} // my file info
|
||||
files, err := os.ReadDir(p)
|
||||
output := []FileInfo{} // my file info
|
||||
files, err := os.ReadDir(path.Clean(p)) // clean for prettier errors
|
||||
if os.IsNotExist(err) {
|
||||
return output, err // return empty list
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user