mirror of https://github.com/spf13/afero.git
rclone: CreateRCFS
This commit is contained in:
parent
c04f83af6a
commit
71e5cee5db
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue