nativemodel_darwin.go 791 B

12345678910111213141516171819202122232425262728293031323334
  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, files []FileInfo) {
  9. for i := range files {
  10. files[i].Name = norm.NFD.String(files[i].Name)
  11. }
  12. m.next.Index(nodeID, files)
  13. }
  14. func (m nativeModel) IndexUpdate(nodeID string, files []FileInfo) {
  15. for i := range files {
  16. files[i].Name = norm.NFD.String(files[i].Name)
  17. }
  18. m.next.IndexUpdate(nodeID, 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. }