Skip to content

Commit 2067bb9

Browse files
committed
ugliness for Scala 2.11 support
1 parent bf1705d commit 2067bb9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

os/src/Path.scala

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package os
22

33
import java.net.URI
4-
import java.nio.file.Paths
4+
import java.nio.file.{LinkOption, Paths}
55
import java.nio.file.Files
66

77
import collection.JavaConverters._
@@ -282,7 +282,7 @@ class RelPath private[os] (segments0: Array[String], val ups: Int)
282282
case _ => false
283283
}
284284

285-
def toNIO = Paths.get(toString)
285+
def toNIO = java.nio.file.Paths.get(toString)
286286

287287
def asSubPath = {
288288
require(ups == 0)
@@ -343,7 +343,7 @@ class SubPath private[os] (val segments0: Array[String])
343343
case _ => false
344344
}
345345

346-
def toNIO = Paths.get(toString)
346+
def toNIO = java.nio.file.Paths.get(toString)
347347

348348
def resolveFrom(base: os.Path) = base / this
349349
}
@@ -509,7 +509,16 @@ class TempPath private[os] (wrapped: java.nio.file.Path)
509509
*/
510510
private def deleteRecursively(ioPath: java.nio.file.Path): Unit = {
511511
if (Files.isDirectory(ioPath)) {
512-
Files.list(ioPath).forEach(deleteRecursively)
512+
// while we support Scala 2.11 we need (something like) this:
513+
Files.list(ioPath).forEach(
514+
new java.util.function.Consumer[java.nio.file.Path] {
515+
override def accept(path: java.nio.file.Path): Unit =
516+
deleteRecursively(path)
517+
}
518+
)
519+
520+
// this works for Scala 2.12+
521+
// Files.list(ioPath).forEach(deleteRecursively)
513522
}
514523
Files.deleteIfExists(ioPath)
515524
}

0 commit comments

Comments
 (0)