Create tested

This commit is contained in:
mkvolkov 2022-08-20 19:59:01 +03:00
parent 9041843981
commit abb7f53bae
2 changed files with 9 additions and 57 deletions

View File

@ -2,7 +2,7 @@ package rclonefs
import ( import (
"context" "context"
"fmt" "errors"
"io/fs" "io/fs"
"os" "os"
"os/user" "os/user"
@ -157,13 +157,11 @@ func (rcfs *RCFS) Rename(oldname, newname string) error {
} }
func (rcfs *RCFS) Chmod(name string, mode os.FileMode) error { func (rcfs *RCFS) Chmod(name string, mode os.FileMode) error {
// TODO return errors.New("Chmod is not supported")
return nil
} }
func (rcfs *RCFS) Chown(name string, uid, gid int) error { func (rcfs *RCFS) Chown(name string, uid, gid int) error {
// TODO return errors.New("Chown is not supported")
return nil
} }
func (rcfs *RCFS) Chtimes(name string, atime time.Time, mtime time.Time) error { 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) 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
}
}
*/

View File

@ -4,18 +4,18 @@ import (
"fmt" "fmt"
"os" "os"
// "github.com/spf13/afero"
"github.com/spf13/afero/rclonefs" "github.com/spf13/afero/rclonefs"
) )
func main() { func main() {
RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:/cfg") RFS, _ := rclonefs.CreateRCFS("pcloud_mv1:/cfg/json")
name := "ycfg"
err := RFS.RemoveAll(name) f, e := RFS.Create("../obj3.json")
if err != nil { if e != nil {
fmt.Printf("Error: %v\n", err) fmt.Printf("Error: %v\n", e)
os.Exit(1) os.Exit(1)
} }
defer f.Close()
} }