mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
lib/osutil: Fix globbing at root (fixes #3201)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3202
This commit is contained in:
parent
87701339fe
commit
242db26343
@ -11,6 +11,7 @@ package osutil
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -32,7 +33,9 @@ func Glob(pattern string) (matches []string, err error) {
|
|||||||
case string(filepath.Separator):
|
case string(filepath.Separator):
|
||||||
// nothing
|
// nothing
|
||||||
default:
|
default:
|
||||||
dir = dir[0 : len(dir)-1] // chop off trailing separator
|
if runtime.GOOS != "windows" || len(dir) < 2 || dir[len(dir)-2] != ':' {
|
||||||
|
dir = dir[0 : len(dir)-1] // chop off trailing separator, if it's not after the drive letter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hasMeta(dir) {
|
if !hasMeta(dir) {
|
||||||
|
Loading…
Reference in New Issue
Block a user