Commit 8c0b17a3 by Amelin Konstantin

Fix close zip

parent a0df5972
...@@ -91,6 +91,7 @@ object Main { ...@@ -91,6 +91,7 @@ object Main {
e.getLastModifiedTime, e.getLastModifiedTime,
Some(zip.getInputStream(e)), Some(zip.getInputStream(e)),
zip.getInputStream(e), zip.getInputStream(e),
Some(zip),
None) None)
} }
} match { } match {
...@@ -103,6 +104,7 @@ object Main { ...@@ -103,6 +104,7 @@ object Main {
Files.getLastModifiedTime(p), Files.getLastModifiedTime(p),
None, None,
Files.newInputStream(p), Files.newInputStream(p),
None,
Some(ex.toString)) Some(ex.toString))
) )
} }
...@@ -113,6 +115,7 @@ object Main { ...@@ -113,6 +115,7 @@ object Main {
Files.getLastModifiedTime(p), Files.getLastModifiedTime(p),
Some(Files.newInputStream(p)), Some(Files.newInputStream(p)),
Files.newInputStream(p), Files.newInputStream(p),
None,
None) None)
) )
} }
...@@ -167,11 +170,19 @@ object Main { ...@@ -167,11 +170,19 @@ object Main {
} }
} }
sourceArray.foreach { sourceArray
f => .filter { f => f.zip.nonEmpty }
f.streamMove.close() .groupBy { f => f.zip.get }
if (f.streamConvert.nonEmpty) f.streamConvert.get.close() .keys
} .foreach { _.close() }
sourceArray
.filter { f => f.zip.isEmpty }
.foreach {
f =>
f.streamMove.close()
if (f.streamConvert.nonEmpty) f.streamConvert.get.close()
}
paths.foreach { paths.foreach {
p => Files.delete(p) p => Files.delete(p)
...@@ -292,6 +303,7 @@ object Main { ...@@ -292,6 +303,7 @@ object Main {
modified: FileTime, modified: FileTime,
streamConvert: Option[InputStream], streamConvert: Option[InputStream],
streamMove: InputStream, streamMove: InputStream,
zip: Option[ZipFile],
msg: Option[String] msg: Option[String]
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment