nativemodel_darwin.go 901 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (C) 2014 The Protocol Authors.
  2. // +build darwin
  3. package protocol
  4. // Darwin uses NFD normalization
  5. import "golang.org/x/text/unicode/norm"
  6. type nativeModel struct {
  7. Model
  8. }
  9. func (m nativeModel) Index(deviceID DeviceID, folder string, files []FileInfo) {
  10. for i := range files {
  11. files[i].Name = norm.NFD.String(files[i].Name)
  12. }
  13. m.Model.Index(deviceID, folder, files)
  14. }
  15. func (m nativeModel) IndexUpdate(deviceID DeviceID, folder string, files []FileInfo) {
  16. for i := range files {
  17. files[i].Name = norm.NFD.String(files[i].Name)
  18. }
  19. m.Model.IndexUpdate(deviceID, folder, files)
  20. }
  21. func (m nativeModel) Request(deviceID DeviceID, folder, name string, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error) {
  22. name = norm.NFD.String(name)
  23. return m.Model.Request(deviceID, folder, name, size, offset, hash, weakHash, fromTemporary)
  24. }