Documentation ¶
Overview ¶
Package fs provides functionality to interact with the file system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface { // UserHomeDir returns the path to the current user's home directory. // It returns an error if the home directory cannot be determined. UserHomeDir() (string, error) // MkdirAll creates a directory named path, along with any necessary parents. // The permission bits perm are used for all directories that MkdirAll creates. // If path is already a directory, MkdirAll does nothing and returns nil. MkdirAll(path string, perm os.FileMode) error }
FileSystem is an interface that defines methods for interacting with the file system.
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem is a struct that implements the FileSystem interface.
func (OSFileSystem) MkdirAll ¶
func (fs OSFileSystem) MkdirAll(path string, perm os.FileMode) error
MkdirAll is a method on the OSFileSystem struct that creates a directory named path, along with any necessary parents. It uses the os package's MkdirAll function to do this. The permission bits perm are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil.
func (OSFileSystem) UserHomeDir ¶
func (fs OSFileSystem) UserHomeDir() (string, error)
UserHomeDir is a method on the OSFileSystem struct that retrieves the path to the current user's home directory. It uses the os package's UserHomeDir function to do this. It returns an error if the home directory cannot be determined.