mount: just set default options without checking if customized by user, because it will be overridden anyway

This commit is contained in:
albertony 2020-11-15 01:29:10 +01:00 committed by Nick Craig-Wood
parent 07c40780b3
commit e3191d096f

View File

@ -12,7 +12,6 @@ import (
"fmt" "fmt"
"os" "os"
"runtime" "runtime"
"strings"
"time" "time"
"github.com/billziss-gh/cgofuse/fuse" "github.com/billziss-gh/cgofuse/fuse"
@ -46,28 +45,9 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
options = append(options, "-o", "debug") options = append(options, "-o", "debug")
} }
// Determine if ExtraOptions already has an opt in
hasExtraOption := func(optionName string) bool {
optionName += "="
for _, option := range opt.ExtraOptions {
suboptions := strings.Split(option, ",")
for _, suboption := range suboptions {
if strings.HasPrefix(suboption, optionName) {
return true
}
}
}
return false
}
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
// Setting uid and gid to -1 by default, which mean current user in WinFsp options = append(options, "-o", "uid=-1")
if !hasExtraOption("uid") { options = append(options, "-o", "gid=-1")
options = append(options, "-o", "uid=-1")
}
if !hasExtraOption("gid") {
options = append(options, "-o", "gid=-1")
}
options = append(options, "--FileSystemName=rclone") options = append(options, "--FileSystemName=rclone")
if opt.VolumeName != "" { if opt.VolumeName != "" {
if opt.NetworkMode { if opt.NetworkMode {