Skip to content

Commit 3dfa3fd

Browse files
committed
.
1 parent 3c6daf8 commit 3dfa3fd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

os/src/ZipOps.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import java.nio.file.attribute.{
1313
import java.util.zip.{ZipEntry, ZipFile, ZipInputStream, ZipOutputStream}
1414
import scala.collection.JavaConverters._
1515
import scala.util.matching.Regex
16+
import scala.util.Properties.isWin
1617

1718
object zip {
1819

@@ -78,7 +79,7 @@ object zip {
7879
includePatterns,
7980
(path, sub) => {
8081
os.copy(path, opened / sub, createFolders = true)
81-
if (!scala.util.Properties.isWin && Runtime.version.feature >= 14)
82+
if (!isWin && Runtime.version.feature >= 14)
8283
Files.setPosixFilePermissions((opened / sub).wrapped, os.perms(path).toSet())
8384
if (!preserveMtimes) {
8485
os.mtime.set(opened / sub, 0)
@@ -202,7 +203,7 @@ object zip {
202203
val mtime = if (preserveMtimes) os.mtime(file) else 0
203204
zipEntry.setTime(mtime)
204205

205-
if (!scala.util.Properties.isWin) {
206+
if (!isWin) {
206207
val mode = apache.PermissionUtils.modeFromPermissions(
207208
os.perms(file, followLinks = followLinks).toSet(),
208209
toFileType(file, followLinks = followLinks)
@@ -211,7 +212,7 @@ object zip {
211212
}
212213

213214
val fis =
214-
if (!followLinks && !scala.util.Properties.isWin && os.isLink(file))
215+
if (!followLinks && !isWin && os.isLink(file))
215216
Some(new java.io.ByteArrayInputStream(os.readLink(file).toString().getBytes()))
216217
else if (os.isFile(file)) Some(os.read.inputStream(file))
217218
else None
@@ -321,13 +322,13 @@ object unzip {
321322
for ((zipEntry, zipInputStream) <- zipEntryInputStreams) {
322323
val newFile = dest / os.SubPath(zipEntry.getName)
323324
val mode = zipEntry.getUnixMode
324-
val perms = if (mode > 0 && !scala.util.Properties.isWin) {
325+
val perms = if (mode > 0 && !isWin) {
325326
os.PermSet.fromSet(apache.PermissionUtils.permissionsFromMode(mode))
326327
} else null
327328

328329
if (zipEntry.isDirectory) {
329330
os.makeDir.all(newFile, perms = perms)
330-
} else if (!scala.util.Properties.isWin && isSymLink(mode)) {
331+
} else if (!isWin && isSymLink(mode)) {
331332
val target = scala.io.Source.fromInputStream(zipInputStream).mkString
332333
val path = java.nio.file.Paths.get(target)
333334
val dest = if (path.isAbsolute) os.Path(path) else os.RelPath(path)
@@ -337,7 +338,7 @@ object unzip {
337338
val outputStream = os.write.outputStream(newFile, createFolders = true)
338339
os.Internals.transfer(zipInputStream, outputStream, close = false)
339340
outputStream.close()
340-
if (!scala.util.Properties.isWin && perms != null) os.perms.set(newFile, perms)
341+
if (!isWin && perms != null) os.perms.set(newFile, perms)
341342
}
342343
}
343344
} finally {

0 commit comments

Comments
 (0)