]> Cypherpunks repositories - gostls13.git/commitdiff
os: make RemoveAll() work on windows
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 17 Sep 2010 02:35:34 +0000 (12:35 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 17 Sep 2010 02:35:34 +0000 (12:35 +1000)
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/2212041

src/pkg/os/path.go

index bea971375eb9466f91c58cde8f9f1526899896fd..74c83ab17aae4a26e81445062a4f1e3a9376fde9 100644 (file)
@@ -84,7 +84,6 @@ func RemoveAll(path string) Error {
        if err != nil {
                return err
        }
-       defer fd.Close()
 
        // Remove contents & return first error.
        err = nil
@@ -105,6 +104,9 @@ func RemoveAll(path string) Error {
                }
        }
 
+       // Close directory, because windows won't remove opened directory.
+       fd.Close()
+
        // Remove directory.
        err1 := Remove(path)
        if err == nil {