Updated use of convertFileSize() in a ScanDirectory() function.
This commit is contained in:
parent
0798ba6602
commit
920f9f08ee
@ -52,12 +52,11 @@ func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStats, er
|
|||||||
})
|
})
|
||||||
stats.Directories++
|
stats.Directories++
|
||||||
} else {
|
} else {
|
||||||
_, _, sz := convertFileSize(entry.Size())
|
|
||||||
fileEntries = append(fileEntries, DirEntry{
|
fileEntries = append(fileEntries, DirEntry{
|
||||||
Name: entry.Name(),
|
Name: entry.Name(),
|
||||||
Link: "/file" + urlBase + url.PathEscape(entry.Name()),
|
Link: "/file" + urlBase + url.PathEscape(entry.Name()),
|
||||||
Datetime: entry.ModTime(),
|
Datetime: entry.ModTime(),
|
||||||
Size: sz,
|
Size: convertFileSize(entry.Size()),
|
||||||
})
|
})
|
||||||
|
|
||||||
totalFilesSize += entry.Size()
|
totalFilesSize += entry.Size()
|
||||||
@ -65,8 +64,7 @@ func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStats, er
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, sz := convertFileSize(totalFilesSize)
|
stats.FilesSize = convertFileSize(totalFilesSize)
|
||||||
stats.FilesSize = sz
|
|
||||||
|
|
||||||
entries = append(entries, dirEntries...)
|
entries = append(entries, dirEntries...)
|
||||||
entries = append(entries, fileEntries...)
|
entries = append(entries, fileEntries...)
|
||||||
|
Loading…
Reference in New Issue
Block a user