config.go 844 B

12345678910111213141516171819202122232425262728
  1. package utils
  2. import (
  3. "os"
  4. "path/filepath"
  5. )
  6. func GetPath(flag int) string {
  7. //basedir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
  8. basedir, _ := os.Getwd()
  9. switch flag {
  10. case 0:
  11. return basedir + string(filepath.Separator) + "conf" + string(filepath.Separator)
  12. case 1:
  13. return basedir + string(filepath.Separator) + "dev" + string(filepath.Separator)
  14. case 2:
  15. return basedir + string(filepath.Separator) + "model" + string(filepath.Separator)
  16. case 3:
  17. return basedir + string(filepath.Separator) + "log" + string(filepath.Separator)
  18. case 4:
  19. return basedir + string(filepath.Separator) + "tmp" + string(filepath.Separator)
  20. case 5:
  21. return basedir + string(filepath.Separator) + "pole" + string(filepath.Separator)
  22. case 6:
  23. return basedir + string(filepath.Separator) + "rule" + string(filepath.Separator)
  24. }
  25. return ""
  26. }