forked from Elara6331/infinitime
		
	Add Stat() to filesystem implementation
This commit is contained in:
		@@ -1,5 +1,29 @@
 | 
			
		||||
package blefs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"io/fs"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Stat does a ReadDir() and finds the current file in the output
 | 
			
		||||
func (blefs *FS) Stat(path string) (fs.FileInfo, error) {
 | 
			
		||||
	// Get directory in filepath
 | 
			
		||||
	dir := filepath.Dir(path)
 | 
			
		||||
	// Read directory
 | 
			
		||||
	dirEntries, err := blefs.ReadDir(dir)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	for _, entry := range dirEntries {
 | 
			
		||||
		// If file name is base name of path
 | 
			
		||||
		if entry.Name() == filepath.Base(path) {
 | 
			
		||||
			// Return file info
 | 
			
		||||
			return entry.Info()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil, ErrFileNotExists
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Rename moves or renames a file or directory
 | 
			
		||||
func (blefs *FS) Rename(old, new string) error {
 | 
			
		||||
	// Create move request
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user