nativemodel_windows.go 789 B

12345678910111213141516171819202122232425262728293031323334
  1. // +build windows
  2. package protocol
  3. // Windows uses backslashes as file separator
  4. import "path/filepath"
  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 = filepath.FromSlash(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 = filepath.FromSlash(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 = filepath.FromSlash(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. }