Documentation ¶
Index ¶
- type Aferox
- func (a Aferox) Abs(path string) string
- func (a Aferox) Chdir(dir string)
- func (a Aferox) Chown(name string, uid int, gid int) error
- func (a Aferox) Getwd() string
- func (a Aferox) LookPath(cmd string, path string, pathExt string) (string, bool)
- func (a Aferox) TempDir(dir string, prefix string) (string, error)
- func (a Aferox) TempFile(dir string, pattern string) (afero.File, error)
- type Fsx
- func (f *Fsx) Abs(path string) string
- func (f *Fsx) Chdir(dir string)
- func (f *Fsx) Chmod(name string, mode os.FileMode) error
- func (f *Fsx) Chown(name string, uid, gid int) error
- func (f *Fsx) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (f *Fsx) Create(name string) (afero.File, error)
- func (f *Fsx) Getwd() string
- func (f *Fsx) Mkdir(name string, perm os.FileMode) error
- func (f *Fsx) MkdirAll(path string, perm os.FileMode) error
- func (f *Fsx) Name() string
- func (f *Fsx) Open(name string) (afero.File, error)
- func (f *Fsx) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (f *Fsx) Remove(name string) error
- func (f *Fsx) RemoveAll(path string) error
- func (f *Fsx) Rename(oldname, newname string) error
- func (f *Fsx) Stat(name string) (os.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aferox ¶
Aferox adjusts all relative paths based on the stored working directory, instead of relying on the default behavior for relative paths defined by the implementing Fs.
func NewAferox ¶
NewAferox creates a wrapper around a filesystem representation with an independent working directory.
func (Aferox) Abs ¶
Abs returns an absolute representation of path. If the path is not absolute it will be joined with the current working directory to turn it into an absolute path. The absolute path name for a given file is not guaranteed to be unique. Abs calls Clean on the result. Use in place of filepath.Abs.
func (Aferox) Chdir ¶
Chdir changes the current working directory to the named directory. Use in place of os.Chdir.
func (Aferox) Getwd ¶
Getwd returns a rooted path name corresponding to the current directory. Use in place of os.Getwd.
func (Aferox) LookPath ¶
This is a simplified exec.LookPath that checks if command is accessible given a PATH string. Use in place of exec.LookPath when you need need an independent check that a file exists in a path list, for example you do not want to use the current process's environment variables.
func (Aferox) TempDir ¶ added in v0.2.1
TempDir creates a new temporary directory in the directory dir with a name beginning with prefix and returns the path of the new directory. If dir is the empty string, TempDir uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempDir simultaneously will not choose the same directory. It is the caller's responsibility to remove the directory when no longer needed.
func (Aferox) TempFile ¶ added in v0.2.1
TempFile creates a new temporary file in the directory dir, opens the file for reading and writing, and returns the resulting *os.File. The filename is generated by taking pattern and adding a random string to the end. If pattern includes a "*", the random string replaces the last "*". If dir is the empty string, TempFile uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempFile simultaneously will not choose the same file. The caller can use f.Name() to find the pathname of the file. It is the caller's responsibility to remove the file when no longer needed.
type Fsx ¶
type Fsx struct {
// contains filtered or unexported fields
}
Fsx adjusts all relative paths based on the stored working directory, instead of relying on the default behavior for relative paths defined by the implementing Fs.
func (*Fsx) Abs ¶
Abs returns an absolute representation of path. If the path is not absolute it will be joined with the current working directory to turn it into an absolute path. The absolute path name for a given file is not guaranteed to be unique. Abs calls Clean on the result.
func (*Fsx) Chmod ¶
Chmod changes the mode of the named file to mode. If the file is a symbolic link, it changes the mode of the link's target. If there is an error, it will be of type *PathError.
A different subset of the mode bits are used, depending on the operating system.
func (*Fsx) Chtimes ¶
Chtimes changes the access and modification times of the named file, similar to the Unix utime() or utimes() functions.
func (*Fsx) Create ¶
Create creates or truncates the named file. If the file already exists, it is truncated. If the file does not exist, it is created with mode 0666 (before umask). If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR.
func (*Fsx) Mkdir ¶
Mkdir creates a new directory with the specified name and permission bits (before umask).
func (*Fsx) MkdirAll ¶
MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil.
func (*Fsx) Open ¶
OpenFile is the generalized open call; most users will use Open or Create instead. It opens the named file with specified flag (O_RDONLY etc.). If the file does not exist, and the O_CREATE flag is passed, it is created with mode perm (before umask). If successful, methods on the returned File can be used for I/O.
func (*Fsx) RemoveAll ¶
RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error).