From 2ec9b16667bb18b3479136a6cbb615011033f7c0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 25 Jan 2016 17:57:19 -0800 Subject: [PATCH] deleteBucket: Directory not empty error on windows is "directory is not empty" --- pkg/fs/fs-bucket.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/fs/fs-bucket.go b/pkg/fs/fs-bucket.go index 5f2845df6..c42d4c5a2 100644 --- a/pkg/fs/fs-bucket.go +++ b/pkg/fs/fs-bucket.go @@ -48,6 +48,12 @@ func (fs Filesystem) DeleteBucket(bucket string) *probe.Error { return probe.NewError(e) } if e := os.Remove(bucketDir); e != nil { + // On windows the string is slightly different, handle it here. + if strings.Contains(e.Error(), "directory is not empty") { + return probe.NewError(BucketNotEmpty{Bucket: bucket}) + } + // Hopefully for all other operating systems, this is + // assumed to be consistent. if strings.Contains(e.Error(), "directory not empty") { return probe.NewError(BucketNotEmpty{Bucket: bucket}) }