fs

package
v2.0.0-alpha.38 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 9 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)

Credit: https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04 CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

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 GetSubdirectories

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

GetSubdirectories returns a list of subdirectories for the given root directory

func LocalDirectory

func LocalDirectory() string

LocalDirectory gets the caller's file directory Equivalent to node's __DIRNAME

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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