From 92e8bf46117920adbe9679f4c52da58af3416131 Mon Sep 17 00:00:00 2001 From: sinofp Date: Sun, 11 Jul 2021 15:13:06 +0800 Subject: Rm java.io in WriteEmitted (#2275) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>--- src/main/scala/firrtl/stage/phases/WriteEmitted.scala | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/scala/firrtl/stage/phases/WriteEmitted.scala b/src/main/scala/firrtl/stage/phases/WriteEmitted.scala index 010e85c3..90b0e123 100644 --- a/src/main/scala/firrtl/stage/phases/WriteEmitted.scala +++ b/src/main/scala/firrtl/stage/phases/WriteEmitted.scala @@ -2,7 +2,7 @@ package firrtl.stage.phases -import firrtl.{AnnotationSeq, EmittedCircuitAnnotation, EmittedModuleAnnotation} +import firrtl.{AnnotationSeq, EmittedCircuitAnnotation, EmittedModuleAnnotation, FileUtils} import firrtl.options.{Phase, StageOptions, Viewer} import firrtl.stage.FirrtlOptions @@ -44,16 +44,14 @@ class WriteEmitted extends Phase { annotations.flatMap { case a: EmittedModuleAnnotation[_] => - val pw = new PrintWriter(sopts.getBuildFileName(a.value.name, Some(a.value.outputSuffix))) - pw.write(a.value.value) - pw.close() + val target = FileUtils.getPath(sopts.getBuildFileName(a.value.name, Some(a.value.outputSuffix))) + os.write(target, a.value.value) None case a: EmittedCircuitAnnotation[_] => - val pw = new PrintWriter( + val target = FileUtils.getPath( sopts.getBuildFileName(fopts.outputFileName.getOrElse(a.value.name), Some(a.value.outputSuffix)) ) - pw.write(a.value.value) - pw.close() + os.write(target, a.value.value) None case a => Some(a) } -- cgit v1.2.3