Documentation ¶
Index ¶
- func AppendStringToFile(path string, appendString string) error
- func CanCreateSymlinks() bool
- func CheckSignatureOrNoFile(path string, signature string) error
- func CopyDir(src string, dst string) error
- func CopyEmbedAssets(fsys embed.FS, sourceDir string, targetDir string) error
- func CopyFile(src string, dst string) error
- func ExpandFilesAndDirectories(dir string, paths []string) ([]string, error)
- func FgrepStringInFile(fullPath string, needle string) (bool, error)
- func FileExists(name string) bool
- func FileHash(filePath string) (string, error)
- func FileIsReadable(name string) bool
- func FindFilenameInDirectory(basePath string, fileNames []string) (dirName string, err error)
- func GrepStringInFile(fullPath string, needle string) (bool, error)
- func IsDirectory(path string) bool
- func IsSameFile(path1 string, path2 string) (bool, error)
- func ListFilesInDir(path string) ([]string, error)
- func ListFilesInDirFullPath(path string) ([]string, error)
- func PurgeDirectory(path string) error
- func RandomFilenameBase() string
- func ReadFileIntoString(path string) (string, error)
- func RemoveContents(dir string) error
- func ReplaceSimulatedLinks(path string)
- func ReplaceSimulatedXsymSymlinks(links []XSymContents) error
- func ReplaceStringInFile(searchString string, replaceString string, origPath string, destPath string) error
- func TemplateStringToFile(content string, vars map[string]interface{}, targetFilePath string) error
- type XSymContents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendStringToFile ¶ added in v1.21.5
AppendStringToFile takes a path to a file and a string to append and it appends it, returning err
func CanCreateSymlinks ¶ added in v1.21.5
func CanCreateSymlinks() bool
CanCreateSymlinks tests to see if it's possible to create a symlink
func CheckSignatureOrNoFile ¶ added in v1.21.5
CheckSignatureOrNoFile checks to make sure that a file or directory either doesn't exist or has #ddev-generated in its contents (so it can be overwritten) returns nil if overwrite is OK (if sig found or no file existing)
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped. Credit @r0l1 https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04
func CopyEmbedAssets ¶ added in v1.21.5
CopyEmbedAssets copies files in the named embed.FS sourceDir to the local targetDir (full path)
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all its contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage. Credit @m4ng0squ4sh https://gist.github.com/m4ng0squ4sh/92462b38df26839a3ca324697c8cba04
func ExpandFilesAndDirectories ¶ added in v1.22.0
FindFilesInDirectory takes a list of files/directories and expands it into a a list of files only environment variables in list are expanded
func FgrepStringInFile ¶
FgrepStringInFile is a small hammer for looking for a literal string in a file. It should only be used against very modest sized files, as the entire file is read into a string.
func FileIsReadable ¶ added in v1.21.5
FileIsReadable checks to make sure a file exists and is readable
func FindFilenameInDirectory ¶ added in v1.22.0
FindFilenameInDirectory searches the basePath for files of a particular set of names Returns dirName found (can be "") and err
func GrepStringInFile ¶ added in v1.21.5
GrepStringInFile is a small hammer for looking for a regex in a file. It should only be used against very modest sized files, as the entire file is read into a string.
func IsDirectory ¶ added in v1.21.5
IsDirectory returns true if path is a dir, false on error or not directory
func IsSameFile ¶ added in v1.21.5
IsSameFile determines whether two paths refer to the same file/dir
func ListFilesInDir ¶ added in v0.15.0
ListFilesInDir returns an array of files or directories found in a directory
func ListFilesInDirFullPath ¶ added in v1.21.5
ListFilesInDirFullPath returns an array of full path of files found in a directory
func PurgeDirectory ¶
PurgeDirectory removes all of the contents of a given directory, leaving the directory itself intact.
func RandomFilenameBase ¶ added in v0.18.0
func RandomFilenameBase() string
RandomFilenameBase generates a temporary filename for use in testing or whatever. From https://stackoverflow.com/a/28005931/215713
func ReadFileIntoString ¶ added in v1.21.5
ReadFileIntoString just gets the contents of file into string
func RemoveContents ¶ added in v1.21.5
RemoveContents removes contents of passed directory From https://stackoverflow.com/questions/33450980/how-to-remove-all-contents-of-a-directory-using-golang
func ReplaceSimulatedLinks ¶ added in v1.21.5
func ReplaceSimulatedLinks(path string)
ReplaceSimulatedLinks walks the path provided and tries to replace XSym links with real ones.
func ReplaceSimulatedXsymSymlinks ¶ added in v1.21.5
func ReplaceSimulatedXsymSymlinks(links []XSymContents) error
ReplaceSimulatedXsymSymlinks walks a list of XSymContents and makes real symlinks in their place. This is only valid on Windows host, only works with Docker for Windows (cifs filesystem)
Types ¶
type XSymContents ¶ added in v1.21.5
func FindSimulatedXsymSymlinks ¶ added in v1.21.5
func FindSimulatedXsymSymlinks(basePath string) ([]XSymContents, error)
FindSimulatedXsymSymlinks searches the basePath provided for files whose first line is XSym, which is used in cifs filesystem for simulated symlinks.