rclone: CreateRCFS

This commit is contained in:
mkvolkov 2022-08-18 12:00:12 +03:00
parent c04f83af6a
commit 71e5cee5db
2 changed files with 6 additions and 7 deletions

View File

@ -2,7 +2,6 @@ package rclonefs
import (
"context"
"fmt"
"os/user"
"path/filepath"
"strings"
@ -19,7 +18,7 @@ type RCFS struct {
Cwd string
}
func (rcfs *RCFS) CreateRCFS(path string) (*RCFS, error) {
func CreateRCFS(path string) (*RCFS, error) {
u, e := user.Current()
if e != nil {
return nil, e
@ -44,8 +43,5 @@ func (rcfs *RCFS) CreateRCFS(path string) (*RCFS, error) {
vfs := vfs.New(rfs, nil)
data, _ := vfs.ReadFile("mock.json")
fmt.Printf("%s\n", string(data))
return &RCFS{Fs: vfs, Cwd: cwd}, nil
}

View File

@ -1,10 +1,13 @@
package main
import (
"github.com/spf13/afero"
"fmt"
"github.com/spf13/afero/rclonefs"
)
func main() {
newrc := rclonefs.CreateRCFS("godrive_mv1:")
newrc, _ := rclonefs.CreateRCFS("godrive1:")
fmt.Println(newrc)
}