diff --git a/support/util.go b/support/util.go index 37e97c0..7480f38 100644 --- a/support/util.go +++ b/support/util.go @@ -2,6 +2,8 @@ package support import ( "fmt" + "os" + "path/filepath" "reflect" "strings" "unsafe" @@ -161,3 +163,13 @@ func UcFirst(s string) string { func StudlyCase(s string) string { return strings.Replace(strings.Title(strings.Replace(s, "-", " ", -1)), " ", "", -1) } + +func GetAbsPath(s string) string { + if strings.HasPrefix(s, "/") { + return s + } else if dir, err := os.Getwd(); err == nil { + return filepath.Join(dir, s) + } + + return s +}