Skip to content

Commit

Permalink
Merge pull request #110 from zio/fix-windows-stub
Browse files Browse the repository at this point in the history
StubFtp -  windows dont support java.nio.file.Files.getPosixFilePermissions
  • Loading branch information
regis-leray authored Aug 20, 2020
2 parents 2d25292 + 8b3bef0 commit 4c142ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/scala/zio/ftp/TestFtp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package zio.ftp

import java.io.{ FileOutputStream, IOException }
import java.nio.file.NoSuchFileException
import java.nio.file.attribute.PosixFilePermission

import zio.blocking.Blocking
import zio.nio.core.file.{ Path => ZPath }
Expand Down Expand Up @@ -76,7 +77,10 @@ object TestFtp {

private def get(p: ZPath): ZIO[Blocking, IOException, FtpResource] =
(for {
permissions <- Files.getPosixFilePermissions(p)
permissions <- Files.getPosixFilePermissions(p).catchSome {
//Windows don't support this operations
case _: UnsupportedOperationException => ZIO.succeed(Set.empty[PosixFilePermission])
}
isDir <- Files.isDirectory(p).map(Some(_))
lastModified <- Files.getLastModifiedTime(p).map(_.toMillis)
size <- Files.size(p)
Expand Down

0 comments on commit 4c142ec

Please sign in to comment.