smn_file

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 4 Imported by: 31

Documentation

Index

Constants

View Source
const PathSep = string(os.PathSeparator)

PathSep path sep .

Variables

This section is empty.

Functions

func CreateNewFile

func CreateNewFile(fileName string) (*os.File, error)

func DeepTraversalDir

func DeepTraversalDir(path string,
	fileDo func(path string, info os.FileInfo) FileDoFuncResult) (info os.FileInfo, err error)

DeepTraversalDir .

func DeepTraversalDirWithSelf

func DeepTraversalDirWithSelf(path string, fileDo func(path string, info os.FileInfo) FileDoFuncResult) (info os.FileInfo, err error)

DeepTraversalDirWithSelf .

func FileReadAll

func FileReadAll(path string) ([]byte, error)

func FileScanner

func FileScanner(path string) (*bufio.Scanner, *os.File, error)

func IsFileExist

func IsFileExist(fileName string) bool

IsFileExist 判断文件是否存在 存在返回 true 不存在返回false.

func ListDirs

func ListDirs(path string, dirDo func(dPath string)) (err error)

ListDirs ..

func MakeSureDirExist

func MakeSureDirExist(path string) error

MakeSureDirExist if dir not exist, create it.

func Pwd

func Pwd() string

Pwd like system pwd.

func RemoveDirctory

func RemoveDirctory(path string) error

func RemoveFileIfExist

func RemoveFileIfExist(fileName string) error

func SafeOpenFile

func SafeOpenFile(fileName string) (*os.File, error)

Types

type FileDoFunc

type FileDoFunc func(path string, info os.FileInfo) FileDoFuncResult

type FileDoFuncResult

type FileDoFuncResult int
const (
	FILE_DO_FUNC_RESULT_DEFAULT   FileDoFuncResult = iota // continue
	FILE_DO_FUNC_RESULT_STOP_TRAV                         // stop trav
	FILE_DO_FUNC_RESULT_NO_DEAL                           // not deal that file and continue
)

Jump to

Keyboard shortcuts

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