Jelajahi Sumber

archive.ApplyLayer() remove files recursively

Some aufs metadata are directories, and whiteouts can be for
directories, so use os.RemoveAll() for these.
Alexander Larsson 11 tahun lalu
induk
melakukan
484804abff
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      archive/diff.go

+ 2 - 2
archive/diff.go

@@ -35,7 +35,7 @@ func ApplyLayer(dest string, layer Archive) error {
 			return err
 			return err
 		} else if matched {
 		} else if matched {
 			log.Printf("Removing aufs metadata %s", fullPath)
 			log.Printf("Removing aufs metadata %s", fullPath)
-			_ = os.Remove(fullPath)
+			_ = os.RemoveAll(fullPath)
 		}
 		}
 
 
 		filename := filepath.Base(path)
 		filename := filepath.Base(path)
@@ -47,7 +47,7 @@ func ApplyLayer(dest string, layer Archive) error {
 			_ = os.Remove(rmTargetPath)
 			_ = os.Remove(rmTargetPath)
 			// Remove the whiteout itself
 			// Remove the whiteout itself
 			log.Printf("Removing whiteout %s", fullPath)
 			log.Printf("Removing whiteout %s", fullPath)
-			_ = os.Remove(fullPath)
+			_ = os.RemoveAll(fullPath)
 		}
 		}
 		return nil
 		return nil
 	})
 	})