func Pwd() string
func ExamplePwd() {
// Get absolute path of current working directory.
fmt.Println(gfile.Pwd())
// May Output:
// xxx/gf/os/gfile
}
func Home(names ...string) (string, error)
func ExampleHome() {
// user's home directory
homePath, _ := gfile.Home()
fmt.Println(homePath)
// May Output:
// C:\Users\hailaz
}
func TempDir(names ...string) string
func ExampleTempDir() {
// init
var (
fileName = "gfile_example_basic_dir"
)
// fetch an absolute representation of path.
path := gfile.TempDir(fileName)
fmt.Println(path)
// Output:
// /tmp/gfile_example_basic_dir
}
func SelfPath() string
func ExampleSelfPath() {
// Get absolute file path of current running process
fmt.Println(gfile.SelfPath())
// May Output:
// xxx/___github_com_gogf_gf_v2_os_gfile__ExampleSelfPath
}
备案信息: 粤ICP备15087711号-2
Copyright © 2008-2024 啊嘎哇在线工具箱 All Rights.
本站所有资料来源于网络,版权归原作者所有,仅作学习交流使用,如不慎侵犯了您的权利,请联系我们。