This will enable rclone to manage directories properly in the future.
This commit is contained in:
parent
c41b67ea08
commit
aaa1370a36
34 changed files with 220 additions and 89 deletions
|
@ -403,7 +403,11 @@ func (f *Fs) Put(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
|
|||
}
|
||||
|
||||
// Mkdir creates the container if it doesn't exist
|
||||
func (f *Fs) Mkdir() error {
|
||||
func (f *Fs) Mkdir(dir string) error {
|
||||
// Can't create subdirs
|
||||
if dir != "" {
|
||||
return nil
|
||||
}
|
||||
// Check to see if container exists first
|
||||
_, _, err := f.c.Container(f.container)
|
||||
if err == nil {
|
||||
|
@ -419,8 +423,8 @@ func (f *Fs) Mkdir() error {
|
|||
// Rmdir deletes the container if the fs is at the root
|
||||
//
|
||||
// Returns an error if it isn't empty
|
||||
func (f *Fs) Rmdir() error {
|
||||
if f.root != "" {
|
||||
func (f *Fs) Rmdir(dir string) error {
|
||||
if f.root != "" || dir != "" {
|
||||
return nil
|
||||
}
|
||||
return f.c.ContainerDelete(f.container)
|
||||
|
@ -459,7 +463,7 @@ func (f *Fs) Purge() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return f.Rmdir()
|
||||
return f.Rmdir("")
|
||||
}
|
||||
|
||||
// Copy src to this remote using server side copy operations.
|
||||
|
|
|
@ -23,6 +23,7 @@ func TestFsString(t *testing.T) { fstests.TestFsString(t) }
|
|||
func TestFsRmdirEmpty(t *testing.T) { fstests.TestFsRmdirEmpty(t) }
|
||||
func TestFsRmdirNotFound(t *testing.T) { fstests.TestFsRmdirNotFound(t) }
|
||||
func TestFsMkdir(t *testing.T) { fstests.TestFsMkdir(t) }
|
||||
func TestFsMkdirRmdirSubdir(t *testing.T) { fstests.TestFsMkdirRmdirSubdir(t) }
|
||||
func TestFsListEmpty(t *testing.T) { fstests.TestFsListEmpty(t) }
|
||||
func TestFsListDirEmpty(t *testing.T) { fstests.TestFsListDirEmpty(t) }
|
||||
func TestFsNewObjectNotFound(t *testing.T) { fstests.TestFsNewObjectNotFound(t) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue