engine: resources: Rename var
So it doesn't conflict with "path" import.
This commit is contained in:
@@ -1811,12 +1811,12 @@ type FileInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReadDir reads a directory path, and returns a list of enhanced FileInfo's.
|
// ReadDir reads a directory path, and returns a list of enhanced FileInfo's.
|
||||||
func ReadDir(path string) ([]FileInfo, error) {
|
func ReadDir(p string) ([]FileInfo, error) {
|
||||||
if !strings.HasSuffix(path, "/") { // dirs have trailing slashes
|
if !strings.HasSuffix(p, "/") { // dirs have trailing slashes
|
||||||
return nil, fmt.Errorf("path must be a directory")
|
return nil, fmt.Errorf("path must be a directory")
|
||||||
}
|
}
|
||||||
output := []FileInfo{} // my file info
|
output := []FileInfo{} // my file info
|
||||||
files, err := os.ReadDir(path)
|
files, err := os.ReadDir(p)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return output, err // return empty list
|
return output, err // return empty list
|
||||||
}
|
}
|
||||||
@@ -1824,9 +1824,9 @@ func ReadDir(path string) ([]FileInfo, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
abs := path + smartPath(file)
|
abs := p + smartPath(file)
|
||||||
rel, err := filepath.Rel(path, abs) // NOTE: calls Clean()
|
rel, err := filepath.Rel(p, abs) // NOTE: calls Clean()
|
||||||
if err != nil { // shouldn't happen
|
if err != nil { // shouldn't happen
|
||||||
return nil, errwrap.Wrapf(err, "unhandled error in ReadDir")
|
return nil, errwrap.Wrapf(err, "unhandled error in ReadDir")
|
||||||
}
|
}
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
|
|||||||
Reference in New Issue
Block a user