From abb7f53bae9891a8d76ef3139d5b315ffe2e9d3d Mon Sep 17 00:00:00 2001 From: mkvolkov Date: Sat, 20 Aug 2022 19:59:01 +0300 Subject: [PATCH] Create tested --- rclonefs/fs.go | 54 +++------------------------------------------- rclonetest/main.go | 12 +++++------ 2 files changed, 9 insertions(+), 57 deletions(-) diff --git a/rclonefs/fs.go b/rclonefs/fs.go index 55074a2..4fceb77 100644 --- a/rclonefs/fs.go +++ b/rclonefs/fs.go @@ -2,7 +2,7 @@ package rclonefs import ( "context" - "fmt" + "errors" "io/fs" "os" "os/user" @@ -157,13 +157,11 @@ func (rcfs *RCFS) Rename(oldname, newname string) error { } func (rcfs *RCFS) Chmod(name string, mode os.FileMode) error { - // TODO - return nil + return errors.New("Chmod is not supported") } func (rcfs *RCFS) Chown(name string, uid, gid int) error { - // TODO - return nil + return errors.New("Chown is not supported") } func (rcfs *RCFS) Chtimes(name string, atime time.Time, mtime time.Time) error { @@ -171,49 +169,3 @@ func (rcfs *RCFS) Chtimes(name string, atime time.Time, mtime time.Time) error { return rcfs.Fs.Chtimes(name, atime, mtime) } - -func printNode(path string, info fs.FileInfo, err error) error { - if err != nil { - fmt.Printf("prevent panic by handling failure accessing a path %q: %v\n", path, err) - return err - } - if info.IsDir() { - fmt.Printf("visited dir: %q\n", path) - return nil - } else { - fmt.Printf("visited file: %q\n", path) - return nil - } -} -/* -func rmNode(path string, info fs.FileInfo, err error) error { - if err != nil { - return err - } - - if info.IsDir() { - return nil - } else { - a - } -} -*/ - - - - - - - - - - - - - - - - - - - diff --git a/rclonetest/main.go b/rclonetest/main.go index 993c6aa..861477d 100644 --- a/rclonetest/main.go +++ b/rclonetest/main.go @@ -4,18 +4,18 @@ import ( "fmt" "os" -// "github.com/spf13/afero" "github.com/spf13/afero/rclonefs" ) func main() { - RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:/cfg") + RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:/cfg/json") - name := "ycfg" - err := RFS.RemoveAll(name) - if err != nil { - fmt.Printf("Error: %v\n", err) + f, e := RFS.Create("../obj3.json") + if e != nil { + fmt.Printf("Error: %v\n", e) os.Exit(1) } + + defer f.Close() }