fs

package
v2.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src string, dst string) (err error)

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: https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04

func CopyDirExtended

func CopyDirExtended(src string, dst string, ignore []string) (err error)

CopyDirExtended recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. It ignores any files or directories that are given through the ignore parameter. Symlinks are ignored and skipped. Credit: https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04

func CopyFile

func CopyFile(source string, target string) error

CopyFile from source to target

func DeleteFile

func DeleteFile(filename string) error

DeleteFile will delete the given file

func DirExists

func DirExists(path string) bool

DirExists - Returns true if the given path resolves to a directory on the filesystem

func DirIsEmpty

func DirIsEmpty(dir string) (bool, error)

func FileExists

func FileExists(path string) bool

FileExists returns a boolean value indicating whether the given file exists

func FindFileInParents

func FindFileInParents(path string, filename string) string

FindFileInParents searches for a file in the current directory and all parent directories. Returns the absolute path to the file if found, otherwise an empty string

func FindPathToFile

func FindPathToFile(fsys fs.FS, file string) (string, error)

func GetSubdirectories

func GetSubdirectories(rootDir string) (*slicer.StringSlicer, error)

GetSubdirectories returns a list of subdirectories for the given root directory

func MD5File

func MD5File(filename string) (string, error)

MD5File returns the md5sum of the given file

func MkDirs

func MkDirs(fullPath string, mode ...os.FileMode) error

MkDirs creates the given nested directories. Returns error on failure

func Mkdir

func Mkdir(dirname string) error

Mkdir will create the given directory

func MoveFile

func MoveFile(source string, target string) error

MoveFile attempts to move the source file to the target Target is a fully qualified path to a file *name*, not a directory

func MustLoadString

func MustLoadString(filename string) string

MustLoadString attempts to load a string and will abort with a fatal message if something goes wrong

func MustMD5File

func MustMD5File(filename string) string

MustMD5File will call MD5File and abort the program on error

func MustWriteString

func MustWriteString(filename string, data string)

MustWriteString will attempt to write the given data to the given filename It will abort the program in the event of a failure

func RelativePath

func RelativePath(relativepath string, optionalpaths ...string) string

RelativePath returns a qualified path created by joining the directory of the calling file and the given relative path.

Example: RelativePath("..") in *this* file would give you '/path/to/wails2/v2/internal`

func RelativeToCwd

func RelativeToCwd(relativePath string) (string, error)

RelativeToCwd returns an absolute path based on the cwd and the given relative path

func SetPermissions

func SetPermissions(dir string, perm os.FileMode) error

SetPermissions recursively sets file permissions on a directory

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL