ffile

package
v4.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

文件相关操作.

Index

Examples

Constants

This section is empty.

Variables

View Source
var HomeDirectory string

用户主目录.

View Source
var PathListSeparator string = string(os.PathListSeparator)

多路径分隔符. 如, linux下是':'.

View Source
var PathSeparator string = string(os.PathSeparator)

路径分隔符.

Functions

func InstallDirectory

func InstallDirectory()

在主目录下添加目录farmer/ , 包含子目录bin/ etc/ include/ lib/ share/ src/

Example
InstallDirectory()
return
Output:

func Mkdir

func Mkdir(path string) ftype.Error

创建目录.

func Path

func Path(elements ...string) string

将各个元素拼接起来合成路径

Example
println(Path(HomeDirectory, "go-farmer", "test.txt"))
return
Output:

func ReadFile

func ReadFile(filename string) ([]byte, ftype.Error)

读文件.

Example
content, e := ReadFile("/tmp/go-farmer-test.txt")
fassert.CheckError(e)
println(string(content))
return
Output:

func WriteFile

func WriteFile(filename string, data []byte) ftype.Error

写文件.

Example
e := WriteFile("/tmp/go-farmer-test.txt", []byte("hello world."))
fassert.CheckError(e)
return
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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