@@ -3,8 +3,7 @@ package scoverage.report
33import java .io .File
44import java .util .Date
55
6- import _root_ .scoverage .{Coverage , MeasuredClass , MeasuredFile , MeasuredPackage }
7- import org .apache .commons .io .{FileUtils , FilenameUtils }
6+ import scoverage ._
87
98import scala .xml .Node
109
@@ -16,24 +15,26 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
1615 val packageFile = new File (outputDir.getAbsolutePath + " /packages.html" )
1716 val overviewFile = new File (outputDir.getAbsolutePath + " /overview.html" )
1817
19- FileUtils .copyInputStreamToFile(getClass.getResourceAsStream(" /scoverage/index.html" ), indexFile)
20- FileUtils .write(packageFile, packages(coverage).toString())
21- FileUtils .write(overviewFile, overview(coverage).toString())
18+ val index = IOUtils .readStreamAsString(getClass.getResourceAsStream(" /scoverage/index.html" ))
19+ IOUtils .writeToFile(indexFile, index)
20+ IOUtils .writeToFile(packageFile, packages(coverage).toString)
21+ IOUtils .writeToFile(overviewFile, overview(coverage).toString)
2222
2323 coverage.packages.foreach(write)
2424 }
2525
2626 def write (pack : MeasuredPackage ) {
27- val file = new File (outputDir.getAbsolutePath + " /" + pack.name.replace(" <empty>" , " (empty)" ).replace('.' , '/' ) + " /package.html" )
27+ val file = new
28+ File (outputDir.getAbsolutePath, pack.name.replace(" <empty>" , " (empty)" ).replace('.' , '/' ) + " /package.html" )
2829 file.getParentFile.mkdirs()
29- FileUtils .write (file, packageClasses (pack).toString() )
30+ IOUtils .writeToFile (file, packageOverview (pack).toString)
3031 pack.files.foreach(write(_, file.getParentFile))
3132 }
3233
3334 def write (mfile : MeasuredFile , dir : File ) {
34- val file = new File (dir.getAbsolutePath + " / " + FilenameUtils .getName(mfile.source) + " .html" )
35+ val file = new File (dir.getAbsolutePath, IOUtils .getName(mfile.source) + " .html" )
3536 file.getParentFile.mkdirs()
36- FileUtils .write (file, _file(mfile).toString() )
37+ IOUtils .writeToFile (file, _file(mfile).toString)
3738 }
3839
3940 def _file (mfile : MeasuredFile ): Node = {
@@ -149,7 +150,7 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
149150 </head >
150151 }
151152
152- def packageClasses (pack : MeasuredPackage ): Node = {
153+ def packageOverview (pack : MeasuredPackage ): Node = {
153154 <html >
154155 {head}<body style =" font-family: monospace;" >
155156 {classes(pack.classes, false )}
@@ -207,10 +208,8 @@ class ScoverageHtmlWriter(sourceDirectory: File, outputDir: File) {
207208
208209 val filename : String = {
209210
210- val fileRelativeToSource = new File (
211- klass.source.replace(
212- sourceDirectory.getAbsolutePath + File .separator,
213- " " ) + " .html" )
211+ val fileRelativeToSource =
212+ new File (klass.source.replace(sourceDirectory.getAbsolutePath + File .separator, " " ) + " .html" )
214213 val path = fileRelativeToSource.getParent
215214 val value = fileRelativeToSource.getName
216215
0 commit comments