Commit 8c0b17a3 by Amelin Konstantin

Fix close zip

parent a0df5972
......@@ -91,6 +91,7 @@ object Main {
e.getLastModifiedTime,
Some(zip.getInputStream(e)),
zip.getInputStream(e),
Some(zip),
None)
}
} match {
......@@ -103,6 +104,7 @@ object Main {
Files.getLastModifiedTime(p),
None,
Files.newInputStream(p),
None,
Some(ex.toString))
)
}
......@@ -113,6 +115,7 @@ object Main {
Files.getLastModifiedTime(p),
Some(Files.newInputStream(p)),
Files.newInputStream(p),
None,
None)
)
}
......@@ -167,11 +170,19 @@ object Main {
}
}
sourceArray.foreach {
f =>
f.streamMove.close()
if (f.streamConvert.nonEmpty) f.streamConvert.get.close()
}
sourceArray
.filter { f => f.zip.nonEmpty }
.groupBy { f => f.zip.get }
.keys
.foreach { _.close() }
sourceArray
.filter { f => f.zip.isEmpty }
.foreach {
f =>
f.streamMove.close()
if (f.streamConvert.nonEmpty) f.streamConvert.get.close()
}
paths.foreach {
p => Files.delete(p)
......@@ -292,6 +303,7 @@ object Main {
modified: FileTime,
streamConvert: Option[InputStream],
streamMove: InputStream,
zip: Option[ZipFile],
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