Documentation
¶
Index ¶
- func AbsPath(pathname string) string
- func CopyFile(src, dst string) (err error)
- func CopyFileByLinkFirst(src, dst string) (err error)
- func DeleteFile(dst string) (err error)
- func EnsureDir(dir string) (err error)
- func EnsureDirEnh(dir string) (err error)
- func FileExists(filepath string) bool
- func FileModeIs(filepath string, tester func(mode os.FileMode) bool) (ret bool)
- func ForDir(root string, ...) (err error)
- func ForDirMax(root string, initialDepth, maxDepth int, ...) (err error)
- func ForFile(root string, ...) (err error)
- func ForFileMax(root string, initialDepth, maxDepth int, ...) (err error)
- func GetCurrentDir() string
- func GetExecutableDir() string
- func GetExecutablePath() string
- func IsDirectory(filepath string) (bool, error)
- func IsEAccess(err error) bool
- func IsExitError(err error) (int, bool)
- func IsModeCharDevice(mode os.FileMode) bool
- func IsModeDevice(mode os.FileMode) bool
- func IsModeDirectory(mode os.FileMode) bool
- func IsModeExecAll(mode os.FileMode) bool
- func IsModeExecAny(mode os.FileMode) bool
- func IsModeExecGroup(mode os.FileMode) bool
- func IsModeExecOther(mode os.FileMode) bool
- func IsModeExecOwner(mode os.FileMode) bool
- func IsModeIrregular(mode os.FileMode) bool
- func IsModeNamedPipe(mode os.FileMode) bool
- func IsModeReadAll(mode os.FileMode) bool
- func IsModeReadAny(mode os.FileMode) bool
- func IsModeReadGroup(mode os.FileMode) bool
- func IsModeReadOther(mode os.FileMode) bool
- func IsModeReadOwner(mode os.FileMode) bool
- func IsModeRegular(mode os.FileMode) bool
- func IsModeSetgid(mode os.FileMode) bool
- func IsModeSetuid(mode os.FileMode) bool
- func IsModeSocket(mode os.FileMode) bool
- func IsModeSticky(mode os.FileMode) bool
- func IsModeSymbolicLink(mode os.FileMode) bool
- func IsModeWriteAll(mode os.FileMode) bool
- func IsModeWriteAny(mode os.FileMode) bool
- func IsModeWriteGroup(mode os.FileMode) bool
- func IsModeWriteOther(mode os.FileMode) bool
- func IsModeWriteOwner(mode os.FileMode) bool
- func IsRegularFile(filepath string) (bool, error)
- func NormalizeDir(s string) string
- func NormalizePath(pathname string) string
- func RemoveDirRecursive(dir string) (err error)
- func Run(command string, arguments ...string) error
- func RunCommand(command string, readStdout bool, arguments ...string) (retCode int, stdoutText string, err error)
- func RunWithOutput(command string, arguments ...string) (int, string, error)
- func Sudo(command string, arguments ...string) (int, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsPath ¶ added in v0.3.9
AbsPath returns a clean, normalized and absolute path string for the given pathname. Deprecated see also dir.AbsPath
func CopyFile ¶ added in v0.3.12
CopyFile will make a content clone of src. Deprecated see also dir.CopyFile
func CopyFileByLinkFirst ¶ added in v0.3.12
CopyFileByLinkFirst copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherwise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst. Deprecated see also dir.CopyFileByLinkFirst
func DeleteFile ¶ added in v0.3.12
DeleteFile deletes a file if exists Deprecated see also dir.DeleteFile
func EnsureDirEnh ¶
EnsureDirEnh checks and creates the directory, via sudo if necessary. Deprecated see also dir.EnsureDirEnh
func FileExists ¶
FileExists returns the existence of an directory or file Deprecated see also dir.FileExist
func FileModeIs ¶ added in v0.2.3
FileModeIs tests the mode of 'filepath' with 'tester'. Examples:
var yes = exec.FileModeIs("/etc/passwd", exec.IsModeExecAny)
var yes = exec.FileModeIs("/etc/passwd", exec.IsModeDirectory)
Deprecated see also dir.FileModeIs
func ForDir ¶ added in v0.1.18
func ForDir(root string, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)
ForDir walks on `root` directory and its children Deprecated see also dir.ForDir
func ForDirMax ¶ added in v0.1.18
func ForDirMax(root string, initialDepth, maxDepth int, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)
ForDirMax walks on `root` directory and its children with nested levels up to `maxLength`.
Example - discover folder just one level
_ = ForDirMax(dir, 0, 1, func(depth int, cwd string, fi os.FileInfo) (stop bool, err error) {
if fi.IsDir() {
return
}
// ... doing something for a file,
return
})
maxDepth = -1: no limit. initialDepth: 0 if no idea. Deprecated see also dir.ForDirMax
func ForFile ¶ added in v0.3.12
func ForFile(root string, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)
ForFile walks on `root` directory and its children Deprecated see also dir.ForFile
func ForFileMax ¶ added in v0.3.12
func ForFileMax(root string, initialDepth, maxDepth int, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)
ForFileMax walks on `root` directory and its children with nested levels up to `maxLength`.
Example - discover folder just one level
_ = ForFileMax(dir, 0, 1, func(depth int, cwd string, fi os.FileInfo) (stop bool, err error) {
if fi.IsDir() {
return
}
// ... doing something for a file,
return
})
maxDepth = -1: no limit. initialDepth: 0 if no idea.
Deprecated see also dir.ForFileMax
func GetCurrentDir ¶
func GetCurrentDir() string
GetCurrentDir returns the current workingFlag directory it should be equal with os.Getenv("PWD") Deprecated see also dir.GetCurrentDir
func GetExecutableDir ¶
func GetExecutableDir() string
GetExecutableDir returns the executable file directory Deprecated see also dir.GetExecutableDir
func GetExecutablePath ¶ added in v0.1.16
func GetExecutablePath() string
GetExecutablePath returns the executable file path Deprecated see also dir.GetExecutablePath
func IsDirectory ¶
IsDirectory tests whether `path` is a directory or not Deprecated see also dir.IsDirectory
func IsModeCharDevice ¶ added in v0.2.3
IsModeCharDevice give the result of whether a file is a character device Deprecated see also dir.IsModeCharDevice
func IsModeDevice ¶ added in v0.2.3
IsModeDevice give the result of whether a file is a device Deprecated see also dir.IsModeDevice
func IsModeDirectory ¶ added in v0.2.3
IsModeDirectory give the result of whether a file is a directory Deprecated see also dir.IsModeDirectory
func IsModeExecAll ¶ added in v0.2.3
IsModeExecAll give the result of whether a file can be invoked by all users Deprecated see also dir.IsModeExecAll
func IsModeExecAny ¶ added in v0.2.3
IsModeExecAny give the result of whether a file can be invoked by anyone Deprecated see also dir.IsModeExecAny
func IsModeExecGroup ¶ added in v0.2.3
IsModeExecGroup give the result of whether a file can be invoked by its unix-group Deprecated see also dir.IsModeExecGroup
func IsModeExecOther ¶ added in v0.2.3
IsModeExecOther give the result of whether a file can be invoked by its unix-all Deprecated see also dir.IsModeExecOther
func IsModeExecOwner ¶ added in v0.2.3
IsModeExecOwner give the result of whether a file can be invoked by its unix-owner Deprecated see also dir.IsModeExecOwner
func IsModeIrregular ¶ added in v0.2.3
IsModeIrregular give the result of whether a file is a non-regular file; nothing else is known about this file Deprecated see also dir.IsModeIrregular
func IsModeNamedPipe ¶ added in v0.2.3
IsModeNamedPipe give the result of whether a file is a named pipe Deprecated see also dir.IsModePipe
func IsModeReadAll ¶ added in v0.2.3
IsModeReadAll give the result of whether a file can be read by all users Deprecated see also dir.IsModeReadAll
func IsModeReadAny ¶ added in v0.2.3
IsModeReadAny give the result of whether a file can be read by anyone Deprecated see also dir.IsModeReadAny
func IsModeReadGroup ¶ added in v0.2.3
IsModeReadGroup give the result of whether a file can be read by its unix-group Deprecated see also dir.IsModeReadGroup
func IsModeReadOther ¶ added in v0.2.3
IsModeReadOther give the result of whether a file can be read by its unix-all Deprecated see also dir.IsModeReadOther
func IsModeReadOwner ¶ added in v0.2.3
IsModeReadOwner give the result of whether a file can be read by its unix-owner Deprecated see also dir.IsModeReadOwner
func IsModeRegular ¶ added in v0.2.3
IsModeRegular give the result of whether a file is a regular file Deprecated see also dir.IsModeRegular
func IsModeSetgid ¶ added in v0.2.3
IsModeSetgid give the result of whether a file has the setgid bit Deprecated see also dir.IsModeSetgid
func IsModeSetuid ¶ added in v0.2.3
IsModeSetuid give the result of whether a file has the setuid bit Deprecated see also dir.IsModeSetuid
func IsModeSocket ¶ added in v0.2.3
IsModeSocket give the result of whether a file is a socket file Deprecated see also dir.IsModeSocket
func IsModeSticky ¶ added in v0.2.3
IsModeSticky give the result of whether a file is a sticky file Deprecated see also dir.IsModeSticky
func IsModeSymbolicLink ¶ added in v0.2.3
IsModeSymbolicLink give the result of whether a file is a symbolic link Deprecated see also dir.IsModeSymbolicLink
func IsModeWriteAll ¶ added in v0.2.3
IsModeWriteAll give the result of whether a file can be written by all users Deprecated see also dir.IsModeWriteAll
func IsModeWriteAny ¶ added in v0.2.3
IsModeWriteAny give the result of whether a file can be written by anyone Deprecated see also dir.IsModeWriteAny
func IsModeWriteGroup ¶ added in v0.2.3
IsModeWriteGroup give the result of whether a file can be written by its unix-group Deprecated see also dir.IsModeWriteGroup
func IsModeWriteOther ¶ added in v0.2.3
IsModeWriteOther give the result of whether a file can be written by its unix-all Deprecated see also dir.IsModeWriteOther
func IsModeWriteOwner ¶ added in v0.2.3
IsModeWriteOwner give the result of whether a file can be written by its unix-owner Deprecated see also dir.IsModeWriteOwner
func IsRegularFile ¶
IsRegularFile tests whether `path` is a normal regular file or not Deprecated see also dir.IsRegularFile
func NormalizeDir ¶
NormalizeDir make dir name normalized Deprecated see also dir.NormalizeDir
func NormalizePath ¶ added in v0.3.9
NormalizePath cleans up the given pathname Deprecated see also dir.NormalizePath
func RemoveDirRecursive ¶
RemoveDirRecursive removes a directory and any children it contains. Deprecated see also dir.RemoveDirRecursive
func RunCommand ¶
func RunCommand(command string, readStdout bool, arguments ...string) (retCode int, stdoutText string, err error)
RunCommand runs an OS command
func RunWithOutput ¶
RunWithOutput runs an OS command and collect the result outputting
Types ¶
This section is empty.