mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	Reorder a few things
The docs link to this structure and all its methods related to the browse template; keeping them together makes it possible to link to the whole block of code that is relevant.
This commit is contained in:
		
							parent
							
								
									0830c728fe
								
							
						
					
					
						commit
						060ab92d29
					
				@ -106,6 +106,17 @@ type FileInfo struct {
 | 
			
		||||
	Mode    os.FileMode
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HumanSize returns the size of the file as a human-readable string
 | 
			
		||||
// in IEC format (i.e. power of 2 or base 1024).
 | 
			
		||||
func (fi FileInfo) HumanSize() string {
 | 
			
		||||
	return humanize.IBytes(uint64(fi.Size))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HumanModTime returns the modified time of the file as a human-readable string.
 | 
			
		||||
func (fi FileInfo) HumanModTime(format string) string {
 | 
			
		||||
	return fi.ModTime.Format(format)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Implement sorting for Listing
 | 
			
		||||
type byName Listing
 | 
			
		||||
type bySize Listing
 | 
			
		||||
@ -161,17 +172,6 @@ func (l Listing) applySort() {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HumanSize returns the size of the file as a human-readable string
 | 
			
		||||
// in IEC format (i.e. power of 2 or base 1024).
 | 
			
		||||
func (fi FileInfo) HumanSize() string {
 | 
			
		||||
	return humanize.IBytes(uint64(fi.Size))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HumanModTime returns the modified time of the file as a human-readable string.
 | 
			
		||||
func (fi FileInfo) HumanModTime(format string) string {
 | 
			
		||||
	return fi.ModTime.Format(format)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func directoryListing(files []os.FileInfo, r *http.Request, canGoUp bool, root string, ignoreIndexes bool, vars interface{}) (Listing, error) {
 | 
			
		||||
	var fileinfos []FileInfo
 | 
			
		||||
	var dirCount, fileCount int
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user