mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:46:24 +08:00
local: rmdir return an error if the path is not a dir
This commit is contained in:
parent
2bcbed30bd
commit
f5ee16e201
|
@ -642,7 +642,13 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
|
|||
//
|
||||
// If it isn't empty it will return an error
|
||||
func (f *Fs) Rmdir(ctx context.Context, dir string) error {
|
||||
return os.Remove(f.localPath(dir))
|
||||
localPath := f.localPath(dir)
|
||||
if fi, err := os.Stat(localPath); err != nil {
|
||||
return err
|
||||
} else if !fi.IsDir() {
|
||||
return fs.ErrorIsFile
|
||||
}
|
||||
return os.Remove(localPath)
|
||||
}
|
||||
|
||||
// Precision of the file system
|
||||
|
|
Loading…
Reference in New Issue
Block a user