folderutil

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	UnixPathSeparator    = "/"
	WindowsPathSeparator = "\\"
)

Variables

View Source
var Separator = string(os.PathSeparator)

Separator evaluated at runtime

Functions

func AppConfigDirOrDefault

func AppConfigDirOrDefault(defaultAppConfigDir string, toolName string) string

AppConfigDirOrDefault returns the app config directory

func GetFiles

func GetFiles(root string) ([]string, error)

GetFiles within a folder

func HomeDirOrDefault

func HomeDirOrDefault(defaultDirectory string) string

HomeDirectory returns the home directory or defaultDirectory in case of error

func IsUnixOS

func IsUnixOS() bool

func IsWindowsOS

func IsWindowsOS() bool

func MigrateDir

func MigrateDir(sourceDir string, destinationDir string) error

MigrateDir moves all files from sourceDir to destinationDir and removes sourceDir

func UserConfigDirOrDefault

func UserConfigDirOrDefault(defaultConfigDir string) string

UserConfigDirOrDefault returns the user config directory or defaultConfigDir in case of error

Types

type PathInfo

type PathInfo struct {
	IsAbsolute         bool
	RootPath           string
	Parts              []string
	PartsWithSeparator []string
}

PathInfo about a folder

func NewPathInfo

func NewPathInfo(path string) (PathInfo, error)

NewPathInfo returns info about a given path

func (PathInfo) MeshWith

func (pathInfo PathInfo) MeshWith(anotherPath string) ([]string, error)

MeshWith combine all values from Path with another provided path

func (PathInfo) Paths

func (pathInfo PathInfo) Paths() ([]string, error)

Returns all possible combination of the various levels of the path parts

Jump to

Keyboard shortcuts

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