mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
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:
parent
379e2119a8
commit
502bee9a09
@ -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)
|
||||
}
|
||||
|
@ -8,6 +8,6 @@
|
||||
|
||||
package osutil
|
||||
|
||||
func GetDriveLetters() ([]string, error) {
|
||||
return nil, nil
|
||||
func GetFilesystemRoots() ([]string, error) {
|
||||
return []string{"/"}, nil
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user