增加获取家目录方法

This commit is contained in:
2023-04-18 22:32:57 +08:00
parent 0a75d06083
commit 8d9c4231c3
3 changed files with 15 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ import (
"path/filepath"
"runtime"
"strings"
"github.com/mitchellh/go-homedir"
)
type project struct {
@@ -88,3 +90,13 @@ func (p *project) GetProjectPath() string {
dir, _ := os.Getwd()
return dir
}
// GetHomeDir 获取家目录
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 22:31 2023/4/18
func (p *project) GetHomeDir() string {
homePath, _ := homedir.Dir()
return homePath
}