Skip to content

Commit

Permalink
fixed windows path
Browse files Browse the repository at this point in the history
  • Loading branch information
venjiang committed Aug 12, 2020
1 parent 93a96b7 commit cf115fe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cli/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -408,3 +408,7 @@ func (s *Setting) ParseDirectiveGen(doc string) (*GenSet, error) {
}, nil

}

func (s *Setting) SlashPath(path string) string {
return filepath.ToSlash(path)
}

0 comments on commit cf115fe

Please sign in to comment.