Documentation ¶
Overview ¶
Package cfs implements some extra filesystem utilities
Index ¶
- func ChangeExt(path, ext string) string
- func Copy(src, dst string) error
- func Create(path string) (*os.File, error)
- func CreateParents(path string) error
- func DirExists(path string) (bool, error)
- func DropExt(path string) string
- func FileExists(path string) (bool, error)
- func FindDirInParents(dir string) (path string, err error)
- func FindInParents(file string) (path string, err error)
- func ImportPath(absPath string, isDir bool) (string, error)
- func TempFile(prefix, ext string) (f *os.File, err error)
- func TempFileIn(dir, prefix, ext string) (f *os.File, err error)
- func Write(path string, c []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeExt ¶
ChangeExt changes the extension on the given file to the given extension. If there is no previous extension, the new extension is appended to the path.
func Create ¶
Create creates the given file by ensuring that is parent directories exist, then it creates the file.
func CreateParents ¶
CreateParents creates all parents of the given file
func DirExists ¶
DirExists checks if a directory exists, taking care of all of the wonkiness from os.Stat().
func FileExists ¶
FileExists checks if a file exists, taking care of all of the wonkiness from os.Stat().
func FindDirInParents ¶
FindDirInParents climbs the directory tree, from the current directory to the root, looking for a directory with the given name at each level. If found, its absolute path is returned.
func FindInParents ¶
FindInParents climbs the directory tree, from the current directory to the root, looking for a file with the given name at each level. If found, its absolute path is returned.
func ImportPath ¶
ImportPath takes the given absolute path and returns the package that contains the file, in "github.com/iheartradio/cog" form. If !isDir, then the final path element is assumed to be a file and is stripped from the package name.
func TempFile ¶
TempFile creates a new temporary file in /tmp/ (or equivalent) with the given prefix and, unlike ioutil.TempFile, extension.
func TempFileIn ¶
TempFileIn creates a new temporary file in the given directory with the given prefix and, unlike ioutil.TempFile, extension.
Types ¶
This section is empty.