Browse code

ApplyLayer() use RemoveAll to handle removing directories

rmTargetPath can be a directory, so we have to use RemoveAll() or we
will fail to whiteout non-empty directories.

Alexander Larsson authored on 2013/11/15 06:56:18
Showing 1 changed files
... ...
@@ -49,7 +49,7 @@ func ApplyLayer(dest string, layer Archive) error {
49 49
 			rmTargetPath := filepath.Join(filepath.Dir(fullPath), rmTargetName)
50 50
 			// Remove the file targeted by the whiteout
51 51
 			log.Printf("Removing whiteout target %s", rmTargetPath)
52
-			_ = os.Remove(rmTargetPath)
52
+			_ = os.RemoveAll(rmTargetPath)
53 53
 			// Remove the whiteout itself
54 54
 			log.Printf("Removing whiteout %s", fullPath)
55 55
 			_ = os.RemoveAll(fullPath)