Before allocation of these three vars try to read a dir first.
This commit is contained in:
parent
d6463e81e8
commit
cbe0292e4c
@ -23,15 +23,15 @@ type DirEntry struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStat, err error) {
|
func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStat, err error) {
|
||||||
var dirEntries []DirEntry = make([]DirEntry, 0)
|
|
||||||
var fileEntries []DirEntry = make([]DirEntry, 0)
|
|
||||||
var totalFilesSize int64 = 0
|
|
||||||
|
|
||||||
dir, err := os.ReadDir(path)
|
dir, err := os.ReadDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dirEntries []DirEntry = make([]DirEntry, 0)
|
||||||
|
var fileEntries []DirEntry = make([]DirEntry, 0)
|
||||||
|
var totalFilesSize int64 = 0
|
||||||
|
|
||||||
for _, ent := range dir {
|
for _, ent := range dir {
|
||||||
entry, _ := ent.Info()
|
entry, _ := ent.Info()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user