Fix isTempName to work on Windows (fixes #80)
```path.Base()``` is for slash-separated paths, whereas Windows uses "\" to separate paths. Just convert the \ to / and it works.
This commit is contained in:
parent
2d0600de38
commit
d06204959e
|
@ -8,6 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ func (f File) NewerThan(o File) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isTempName(name string) bool {
|
func isTempName(name string) bool {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
name = filepath.ToSlash(name)
|
||||||
|
}
|
||||||
return strings.HasPrefix(path.Base(name), ".syncthing.")
|
return strings.HasPrefix(path.Base(name), ".syncthing.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue