Add directory parameter to Rmdir and Mkdir #100 #831

This will enable rclone to manage directories properly in the future.
This commit is contained in:
Nick Craig-Wood 2016-11-25 21:52:43 +00:00
parent c41b67ea08
commit aaa1370a36
34 changed files with 220 additions and 89 deletions

View file

@ -448,7 +448,11 @@ func (f *Fs) Put(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
}
// Mkdir creates the bucket 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
}
_, err := f.svc.Buckets.Get(f.bucket).Do()
if err == nil {
// Bucket already exists
@ -470,8 +474,8 @@ func (f *Fs) Mkdir() error {
//
// Returns an error if it isn't empty: Error 409: The bucket you tried
// to delete was not empty.
func (f *Fs) Rmdir() error {
if f.root != "" {
func (f *Fs) Rmdir(dir string) error {
if f.root != "" || dir != "" {
return nil
}
return f.svc.Buckets.Delete(f.bucket).Do()