Documentation ¶
Index ¶
- func BaseNoExt(filename string) (outFilename string)
- func CheckOutsideDir(baseFilename, newFilename string) bool
- func CheckOutsideRoot(rootDir, filePath string) (count int)
- func DirKeepSame(f1, f2 string) (same, diff []string)
- func ExtEnsure(filename, ext string, option ...EEOptions) string
- func ExtFileMatch(name string, patterns []string) bool
- func FileInfos(filename string) error
- func GenFileName() string
- func GetAbsRealPath(optionDir string, devMode bool, realUser ...*user.User) (absoluteRealPath, optFilename string)
- func GetCurrentDir() (dir string, err error)
- func GetSimpleFileType(filename string) string
- func IsDirEmpty(name string) (empty bool, err error)
- func IsDirOrSymlinkDir(slRoot string, slStat os.FileInfo) (slIsDir bool)
- func RemovePathBefore(path []string, at string, after ...bool) []string
- func SizeToBytes(size uint32) []byte
- func SplitPath(path string) (outSlice []string)
- func TempFileName(prefix, suffix string) string
- func TempMake(prefix string) string
- func TempRemove(fName string) (err error)
- func TruncatePath(fullpath string, count ...int) (reduced string)
- type EEOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckOutsideDir ¶
CheckOutsideDir: Check if 'filenameNew' is in the same directory as 'filenameOrig'. returns 'false' if the 'root' directory is the same.
func CheckOutsideRoot ¶
CheckOutsideRoot: Check if 'filePath' is outside the current scope of the 'rootDir' (must be a DIRECTORY). count = 0 means 'filePath' is at the same level than 'rootDir'. count > 0 means 'filePath' is in a sub-directory of 'rootDir' and the value
indicate how many sub-directories.
count < 0 means how many parent directories relative to base directory.
func DirKeepSame ¶
DirKeepSame: returns 'same' which corresponds to the equal parts of the two files and 'diff' which corresponds to the change between the two, the 'f1' argument must be the shortest path.
func ExtEnsure ¶
ExtEnsure: Ensuring that the filename has the desired extension. 'option' correspond to 'EEOptions' declaration above.
func ExtFileMatch ¶
FileMatch: If a pattern contained in "patterns" match, true is returned
func GetAbsRealPath ¶
func GetAbsRealPath(optionDir string, devMode bool, realUser ...*user.User) (absoluteRealPath, optFilename string)
Retrieve current realpath and options filename. Options/Config path depend on devMode value, true means current directory, false means current/real user directory '~/.config/Creat/appName' 'realUser' if provided will set the current user (used for root access).
func GetCurrentDir ¶
GetCurrentDir: Get current directory
func GetSimpleFileType ¶
GetSimpleFileType: scan first bytes to detect type of file. This is a basic version for kick usage.
func IsDirOrSymlinkDir ¶
IsDirOrSymlinkDir: File is a directory or a symlinked directory ? Need: os.FileInfo - > os.Lstat
func RemovePathBefore ¶
removePathBefore: remove directories before or after the chosen name
func SizeToBytes ¶
sizeToBytes: convert uint32 size to bytes representation (32bits) "000001f1"
func TempFileName ¶
TempFileName generates a temporary filename for use in testing or whatever
func TempRemove ¶
TempRemove: Remove directory recursively
func TruncatePath ¶
ReducePath: Reduce path length by preserving count element from the end