filemngt

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package filemngt Created by RTT. Author: teocci@yandex.com on 2021-Aug-23

Package filemngt Created by Teocci. Author: teocci@yandex.com on 2021-Aug-26

Package filemngt Created by Teocci. Author: teocci@yandex.com on 2021-Aug-26

Index

Constants

View Source
const (
	NativeEModeTag    = "native"
	UserEModeTag      = "user"
	CustomEModeTag    = "custom"
	UndefinedEModeTag = "undefined"
)

Variables

This section is empty.

Functions

func CustomHomeDir

func CustomHomeDir() (string, error)

func DirExists added in v1.1.1

func DirExists(p string) bool

DirExists checks if a dir exists

func DirExtractPathE added in v1.1.1

func DirExtractPathE(dir string) (string, error)

func ErrCanNotExpandPath

func ErrCanNotExpandPath(p string, e string) error

func ErrCanNotFindPWD added in v1.1.1

func ErrCanNotFindPWD(p, e string) error

func ErrCanNotMakeDir

func ErrCanNotMakeDir(d, e string) error

func ErrCanNotOpenFile

func ErrCanNotOpenFile(f, e string) error

func ErrEmptyEnvironment

func ErrEmptyEnvironment() error

func ErrEmptyOutputForHomeDir

func ErrEmptyOutputForHomeDir() error

func ErrModeNotDefined

func ErrModeNotDefined(m string) error

func ErrNotValidFile

func ErrNotValidFile(f string) error

func ErrPathExistIsNotDirectory added in v1.1.1

func ErrPathExistIsNotDirectory(d string) error

func ErrPathIsNotDirectory added in v1.1.1

func ErrPathIsNotDirectory(d string) error

func Expand

func Expand(path string) string

Expand expands a path to include the home directory as ExpandE Uses the NativeEMode as extraction mode. This function does not return errors.

func ExpandByMode added in v1.1.1

func ExpandByMode(path string, mode ExtractMode) (string, error)

ExpandByMode expands the path to include the home directory as ExpandByModeE. This function does not return errors.

func ExpandByModeE added in v1.1.1

func ExpandByModeE(path string, mode ExtractMode) (string, error)

ExpandByModeE expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is. This function also return errors if any.

func ExpandE added in v1.1.1

func ExpandE(path string) (string, error)

ExpandE expands the path to include the home directory as ExpandByModeE Uses the NativeEMode as extraction mode. This function also return errors if any.

func FileExists added in v1.1.1

func FileExists(f string) bool

FileExists checks if a file exists and is not a directory before we try using it to prevent further errors.

func FileParentDirE added in v1.1.1

func FileParentDirE(f string) (string, error)

FileParentDirE retrieve the file's parent directory. Uses the NativeEMode as extraction mode. This function also return errors if any.

func FilePathE added in v1.1.1

func FilePathE(f string) (string, error)

FilePathE retrieve the file's path. This function also return errors if any.

func Hash added in v1.1.1

func Hash(s string) (uint32, error)

func IsDot

func IsDot(s string) bool

func IsPathSeparator

func IsPathSeparator(s string) bool

func IsPathValid added in v1.1.1

func IsPathValid(p string) bool

func IsTilde

func IsTilde(s string) bool

func MakeDir

func MakeDir(d string) error

MakeDir call os.Mkdir to create a new directory if already exits and check if the existing path is a directory This function also return errors if any.

func MakeDirIfNotExist

func MakeDirIfNotExist(d string) error

MakeDirIfNotExist if the path does not exist call os.Mkdir to create a new directory This function also return errors if any.

func StartWithDot added in v1.1.1

func StartWithDot(s string) bool

func StartWithPS added in v1.1.1

func StartWithPS(s string) bool

func StartWithTilde added in v1.1.1

func StartWithTilde(s string) bool

func String added in v1.1.1

func String(n int32) string

func UserHomeDir added in v1.1.1

func UserHomeDir() string

UserHomeDir returns the current user's home directory (if they have one). Uses the NativeEMode as extraction mode. This function does not return errors.

func UserHomeDirE added in v1.1.1

func UserHomeDirE() (string, error)

UserHomeDirE returns the current user's home directory (if they have one). There are three extraction modes: 1. NativeEMode calls os.UserHomeDir 2. UserEMode instantiate user.Current and gets the HomeDir value 3. CustomEMode calls CustomHomeDir This function also return errors if any.

Types

type ExtractMode

type ExtractMode int
const (
	NativeEMode ExtractMode = iota
	UserEMode
	CustomEMode
	UndefinedEMode
)

Jump to

Keyboard shortcuts

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