fix package name

This commit is contained in:
2023-03-11 12:38:51 +01:00
parent fe5c3e06bb
commit 2f6d435588
2 changed files with 2 additions and 2 deletions

20
root_dir.go Normal file
View File

@@ -0,0 +1,20 @@
package root_dir
import (
"os"
"regexp"
)
func RootDir(projectDirName string) string {
if projectDirName == "" {
return ""
}
projectName := regexp.MustCompile(`^(.*` + projectDirName + `)`)
currentWorkDirectory, _ := os.Getwd()
rootPath := projectName.Find([]byte(currentWorkDirectory))
if len(rootPath) <= 0 {
return ""
}
return string(rootPath)
}