pathikrit / better-files

@@ -29,7 +29,7 @@
Loading
29 29
30 30
    import scala.collection.JavaConverters._
31 31
    key.pollEvents().asScala foreach {
32 -
      case event: WatchEvent[Path] @unchecked if(event.context() != null) =>
32 +
      case event: WatchEvent[Path] @unchecked if (event.context() != null) =>
33 33
        val target: File = path.resolve(event.context())
34 34
        if (reactTo(target)) {
35 35
          if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) {

@@ -839,7 +839,22 @@
Loading
839 839
    * @return file size (for directories, return size of the directory) in bytes
840 840
    */
841 841
  def size(implicit visitOptions: File.VisitOptions = File.VisitOptions.default): Long =
842 -
    walk()(visitOptions).map(f => Files.size(f.path)).sum
842 +
    size(returnZeroIfMissing = isDirectory)
843 +
844 +
  /**
845 +
    * @param returnZeroIfMissing If true, return zeroes for missing files*
846 +
    * @return file size (for directories, return size of the directory) in bytes
847 +
    */
848 +
  def size(returnZeroIfMissing: Boolean)(implicit visitOptions: File.VisitOptions): Long =
849 +
    walk()(visitOptions)
850 +
      .map({ f =>
851 +
        try {
852 +
          Files.size(f.path)
853 +
        } catch {
854 +
          case _: FileNotFoundException if returnZeroIfMissing => 0L
855 +
        }
856 +
      })
857 +
      .sum
843 858
844 859
  def permissions(implicit linkOptions: File.LinkOptions = File.LinkOptions.default): Set[PosixFilePermission] =
845 860
    Files.getPosixFilePermissions(path, linkOptions: _*).asScala.toSet
Files Coverage
core/src/main/scala/better/files 76.78%
akka/src/main/scala/better/files/FileWatcher.scala 83.33%
Project Totals (13 files) 76.93%
255.3
openjdk11=
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading