nativemodel_darwin.go 829 B

1234567891011121314151617181920212223242526272829303132333435
  1. // +build darwin
  2. package protocol
  3. // Darwin uses NFD normalization
  4. import "code.google.com/p/go.text/unicode/norm"
  5. type nativeModel struct {
  6. next Model
  7. }
  8. func (m nativeModel) Index(nodeID string, repo string, files []FileInfo) {
  9. for i := range files {
  10. files[i].Name = norm.NFD.String(files[i].Name)
  11. }
  12. m.next.Index(nodeID, repo, files)
  13. }
  14. func (m nativeModel) IndexUpdate(nodeID string, repo string, files []FileInfo) {
  15. for i := range files {
  16. files[i].Name = norm.NFD.String(files[i].Name)
  17. }
  18. m.next.IndexUpdate(nodeID, repo, files)
  19. }
  20. func (m nativeModel) Request(nodeID, repo string, name string, offset int64, size int) ([]byte, error) {
  21. name = norm.NFD.String(name)
  22. return m.next.Request(nodeID, repo, name, offset, size)
  23. }
  24. func (m nativeModel) Close(nodeID string, err error) {
  25. m.next.Close(nodeID, err)
  26. }