gnsys

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 7 Imported by: 27

README

Package gnsys

A helper package for filesystem operations

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDir

func CleanDir(dir string) error

CleanDir removes all files from a directory or creates the directory if it is absent.

func ConvertTilda

func ConvertTilda(path string) (string, error)

ConvertTilda expands paths with `~/` to an actual home directory.

func DirExists added in v0.2.0

func DirExists(path string) (exists bool, empty bool, err error)

DirExists checks if directory exists and if it is empty

func Download added in v0.3.0

func Download(url, destDir string, showProgress bool) (string, error)

func FileExists

func FileExists(f string) (bool, error)

FileExists checks if a file exists, and that it is a regular file.

func IsDir added in v0.2.0

func IsDir(path string) bool

func IsFile added in v0.2.0

func IsFile(path string) bool

func MakeDir

func MakeDir(dir string) error

MakeDir a directory out of a given unless it already exists.

Types

type DirState added in v0.2.4

type DirState int

DirState represents the state of a directory.

const (
	Unknown DirState = iota
	NotDir
	DirAbsent
	DirEmpty
	DirNotEmpty
)

func GetDirState added in v0.2.4

func GetDirState(dir string) DirState

GetDirState returns the state of a directory.

func (DirState) String added in v0.2.4

func (d DirState) String() string

String returns a string representation of the DirState.

Jump to

Keyboard shortcuts

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