diff --git a/os/src/ZipOps.scala b/os/src/ZipOps.scala index a62d7d49..317b27a8 100644 --- a/os/src/ZipOps.scala +++ b/os/src/ZipOps.scala @@ -219,10 +219,10 @@ object zip { class ZipSource private[os] (val src: os.Path, val dest: Option[os.SubPath]) object ZipSource { implicit def fromPath(src: os.Path): ZipSource = new ZipSource(src, None) + implicit def fromSeqPath(srcs: Seq[os.Path]): Seq[ZipSource] = srcs.map(fromPath) implicit def fromPathTuple(tuple: (os.Path, os.SubPath)): ZipSource = new ZipSource(tuple._1, Some(tuple._2)) } - } object unzip { diff --git a/os/test/src/ZipOpTests.scala b/os/test/src/ZipOpTests.scala index cf6c6d90..70a14d77 100644 --- a/os/test/src/ZipOpTests.scala +++ b/os/test/src/ZipOpTests.scala @@ -176,6 +176,17 @@ object ZipOpTests extends TestSuite { assert(paths == expected) } + test("zipList") - prep { wd => + val sources = wd / "folder1" + val zipFilePath = os.zip( + dest = wd / "my.zip", + sources = os.list(sources) + ) + + val expected = os.unzip.list(source = zipFilePath).map(_.resolveFrom(sources)).toSet + assert(os.list(sources).toSet == expected) + } + test("unzipStream") - prep { wd => // Step 1: Create an in-memory ZIP file as a stream val zipStreamOutput = new ByteArrayOutputStream()