lib/osutil: Return "/" as filesystem root on non-windows (fixes #3321)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3332
This commit is contained in:
Audrius Butkevicius 2016-06-20 20:25:00 +00:00 committed by Jakob Borg
parent 379e2119a8
commit 502bee9a09
3 changed files with 6 additions and 6 deletions

View File

@ -1134,9 +1134,9 @@ func (s *apiService) getPeerCompletion(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemBrowse(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
current := qs.Get("current")
if current == "" && runtime.GOOS == "windows" {
if drives, err := osutil.GetDriveLetters(); err == nil {
sendJSON(w, drives)
if current == "" {
if roots, err := osutil.GetFilesystemRoots(); err == nil {
sendJSON(w, roots)
} else {
http.Error(w, err.Error(), 500)
}

View File

@ -8,6 +8,6 @@
package osutil
func GetDriveLetters() ([]string, error) {
return nil, nil
func GetFilesystemRoots() ([]string, error) {
return []string{"/"}, nil
}

View File

@ -15,7 +15,7 @@ import (
"unsafe"
)
func GetDriveLetters() ([]string, error) {
func GetFilesystemRoots() ([]string, error) {
kernel32, err := syscall.LoadDLL("kernel32.dll")
if err != nil {
return nil, err