mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-14 01:04:14 +00:00
1eb6db6ca8
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3464
35 lines
896 B
Go
35 lines
896 B
Go
// Copyright (C) 2014 The Protocol Authors.
|
|
|
|
// +build windows
|
|
|
|
package protocol
|
|
|
|
// Windows uses backslashes as file separator
|
|
|
|
import "path/filepath"
|
|
|
|
type nativeModel struct {
|
|
Model
|
|
}
|
|
|
|
func (m nativeModel) Index(deviceID DeviceID, folder string, files []FileInfo) {
|
|
fixupFiles(folder, files)
|
|
m.Model.Index(deviceID, folder, files)
|
|
}
|
|
|
|
func (m nativeModel) IndexUpdate(deviceID DeviceID, folder string, files []FileInfo) {
|
|
fixupFiles(folder, files)
|
|
m.Model.IndexUpdate(deviceID, folder, files)
|
|
}
|
|
|
|
func (m nativeModel) Request(deviceID DeviceID, folder string, name string, offset int64, hash []byte, fromTemporary bool, buf []byte) error {
|
|
name = filepath.FromSlash(name)
|
|
return m.Model.Request(deviceID, folder, name, offset, hash, fromTemporary, buf)
|
|
}
|
|
|
|
func fixupFiles(folder string, files []FileInfo) {
|
|
for i := range files {
|
|
files[i].Name = filepath.FromSlash(files[i].Name)
|
|
}
|
|
}
|