diff --git a/cli/setting/setting.go b/cli/setting/setting.go index f366020..bfce2e2 100644 --- a/cli/setting/setting.go +++ b/cli/setting/setting.go @@ -362,22 +362,22 @@ func (s *Setting) IsIteration(path string) bool { } func (s *Setting) IsQuery(path string) bool { - layout := filepath.Join(s.App, s.Model, s.Query) + layout := s.SlashPath(filepath.Join(s.App, s.Model, s.Query)) return strings.HasPrefix(clean(path), layout) } func (s *Setting) IsRepository(path string) bool { - layout := filepath.Join(s.App, s.Repository) + layout := s.SlashPath(filepath.Join(s.App, s.Repository)) return strings.HasPrefix(clean(path), layout) } func (s *Setting) IsService(path string) bool { - layout := filepath.Join(s.App, s.Service) + layout := s.SlashPath(filepath.Join(s.App, s.Service)) return strings.HasPrefix(clean(path), layout) } func (s *Setting) IsController(path string) bool { - layout := filepath.Join(s.Server, s.Controller) + layout := s.SlashPath(filepath.Join(s.Server, s.Controller)) return strings.HasPrefix(clean(path), layout) } @@ -408,3 +408,7 @@ func (s *Setting) ParseDirectiveGen(doc string) (*GenSet, error) { }, nil } + +func (s *Setting) SlashPath(path string) string { + return filepath.ToSlash(path) +}