liuxiaolong
2020-08-10 9358e5ec2d2b65fec4ef9a1be7d1a1e1e2cf9d2d
extend/util/util.go
@@ -8,6 +8,9 @@
   "encoding/hex"
   "fmt"
   "math/rand"
   "os"
   "os/exec"
   "path/filepath"
   "strconv"
   "strings"
   "time"
@@ -82,4 +85,17 @@
      return max
   }
   return rand.Intn(max-min) + min
}
func GetAppRootPath() string {
   file,err:= exec.LookPath(os.Args[0])
   if err != nil {
      return ""
   }
   p, err := filepath.Abs(file)
   if err != nil {
      return ""
   }
   return filepath.Dir(p)
}