增加获取项目目录方法

This commit is contained in:
白茶清欢 2023-01-13 14:41:13 +08:00
parent e68b22a6e1
commit 3529f2b113
2 changed files with 14 additions and 0 deletions

View File

@ -78,3 +78,13 @@ func (p *project) BuildPath(filePathList ...string) string {
} }
return strings.Join(filePathList, p.GetFileSystemSeparator()) return strings.Join(filePathList, p.GetFileSystemSeparator())
} }
// GetProjectPath 获取项目目录
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 14:39 2023/1/13
func (p *project) GetProjectPath() string {
dir, _ := os.Getwd()
return dir
}

View File

@ -21,3 +21,7 @@ func Test_project_BuildPath(t *testing.T) {
fmt.Println(Project.BuildPath("a", "b", "c")) fmt.Println(Project.BuildPath("a", "b", "c"))
fmt.Println(Project.BuildPath("\\a\\", "\\b\\", "\\c\\")) fmt.Println(Project.BuildPath("\\a\\", "\\b\\", "\\c\\"))
} }
func Test_project_GetGetProjectPath(t *testing.T) {
fmt.Println(Project.GetProjectPath())
}