2
0

auto_code.go 571 B

12345678910111213141516171819202122
  1. package config
  2. import (
  3. "path/filepath"
  4. "strings"
  5. )
  6. type Autocode struct {
  7. Web string `mapstructure:"web" json:"web" yaml:"web"`
  8. Root string `mapstructure:"root" json:"root" yaml:"root"`
  9. Server string `mapstructure:"server" json:"server" yaml:"server"`
  10. Module string `mapstructure:"module" json:"module" yaml:"module"`
  11. AiPath string `mapstructure:"ai-path" json:"ai-path" yaml:"ai-path"`
  12. }
  13. func (a *Autocode) WebRoot() string {
  14. webs := strings.Split(a.Web, "/")
  15. if len(webs) == 0 {
  16. webs = strings.Split(a.Web, "\\")
  17. }
  18. return filepath.Join(webs...)
  19. }