mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 09:32:29 +08:00
vfs: factor out the VFS option initialization for re-use #3259
This commit is contained in:
parent
6c832a72ee
commit
626a416ff8
|
@ -193,12 +193,8 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {
|
|||
vfs.Opt = vfscommon.DefaultOpt
|
||||
}
|
||||
|
||||
// Mask the permissions with the umask
|
||||
vfs.Opt.DirPerms &= ^os.FileMode(vfs.Opt.Umask)
|
||||
vfs.Opt.FilePerms &= ^os.FileMode(vfs.Opt.Umask)
|
||||
|
||||
// Make sure directories are returned as directories
|
||||
vfs.Opt.DirPerms |= os.ModeDir
|
||||
// Fill out anything else
|
||||
vfs.Opt.Init()
|
||||
|
||||
// Find a VFS with the same name and options and return it if possible
|
||||
activeMu.Lock()
|
||||
|
|
|
@ -62,3 +62,14 @@ var DefaultOpt = Options{
|
|||
ReadAhead: 0 * fs.Mebi,
|
||||
UsedIsSize: false,
|
||||
}
|
||||
|
||||
// Init the options, making sure everything is withing range
|
||||
func (opt *Options) Init() {
|
||||
// Mask the permissions with the umask
|
||||
opt.DirPerms &= ^os.FileMode(opt.Umask)
|
||||
opt.FilePerms &= ^os.FileMode(opt.Umask)
|
||||
|
||||
// Make sure directories are returned as directories
|
||||
opt.DirPerms |= os.ModeDir
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user