Advertisement
gofuncbrrr

fs helper

Jul 21st, 2021
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.33 KB | None | 0 0
  1. package fs
  2.  
  3. import (
  4.     "fmt"
  5.     "path"
  6.     "path/filepath"
  7.     "runtime"
  8.     "strings"
  9. )
  10.  
  11. func RootDir() string {
  12.     _, b, _, _ := runtime.Caller(0)
  13.     d := path.Join(path.Dir(b))
  14.  
  15.     return strings.TrimRight(filepath.Dir(d), "/tool")
  16. }
  17.  
  18. func FullPath(relativePath string) string {
  19.     return fmt.Sprintf("%s/%s", RootDir(), relativePath)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement