diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-09 01:32:07 -0400 |
---|---|---|
committer | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-09 01:32:07 -0400 |
commit | b69826c7bc44573f01366ef472a59def6e4f1fc5 (patch) | |
tree | ed5fe21c4e5350b47d1dcc22e6007577dd13191e /stage1/Stage1Lib.scala | |
parent | bf534fc64e54af905402833cace7687d73ba8817 (diff) | |
parent | f56a035e5df98bc4e2bf90a1be5a7317be7ef667 (diff) | |
download | cbt-b69826c7bc44573f01366ef472a59def6e4f1fc5.tar.gz cbt-b69826c7bc44573f01366ef472a59def6e4f1fc5.tar.bz2 cbt-b69826c7bc44573f01366ef472a59def6e4f1fc5.zip |
Merge pull request #142 from cvogt/fix-mkdir
Always create directory before trying to write file
Diffstat (limited to 'stage1/Stage1Lib.scala')
-rw-r--r-- | stage1/Stage1Lib.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index d0d22d2..4376c17 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -54,6 +54,8 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ def blue(string: String) = scala.Console.BLUE++string++scala.Console.RESET def green(string: String) = scala.Console.GREEN++string++scala.Console.RESET + def write(file: File, content: String, options: OpenOption*): File = Stage0Lib.write(file, content, options:_*) + def download(url: URL, target: File, sha1: Option[String]): Boolean = { if( target.exists ){ logger.resolver(green("found ") ++ url.string) @@ -231,7 +233,7 @@ ${files.sorted.mkString(" \\\n")} if(code == ExitCode.Success){ // write version and when last compilation started so we can trigger // recompile if cbt version changed or newer source files are seen - Files.write(statusFile.toPath, "".getBytes)//cbtVersion.getBytes) + write(statusFile, "")//cbtVersion.getBytes) Files.setLastModifiedTime(statusFile.toPath, FileTime.fromMillis(start) ) } else { System.exit(code.integer) // FIXME: let's find a better solution for error handling. Maybe a monad after all. @@ -284,7 +286,7 @@ ${files.sorted.mkString(" \\\n")} } else { val result = compute val string = result.map(serialize).mkString("\n") - Files.write(cacheFile.toPath, string.getBytes) + write(cacheFile, string) result } } |