diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-08 22:29:29 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-08 22:37:39 -0400 |
commit | b103b922f8671e7f45cef0cbd876ebe26cb0a2fa (patch) | |
tree | f5ed98ca10fbd55b73b1c743c6faa6ccda8f664d /nailgun_launcher/Stage0Lib.java | |
parent | bf534fc64e54af905402833cace7687d73ba8817 (diff) | |
download | cbt-b103b922f8671e7f45cef0cbd876ebe26cb0a2fa.tar.gz cbt-b103b922f8671e7f45cef0cbd876ebe26cb0a2fa.tar.bz2 cbt-b103b922f8671e7f45cef0cbd876ebe26cb0a2fa.zip |
Always create directory before trying to write file
Diffstat (limited to 'nailgun_launcher/Stage0Lib.java')
-rw-r--r-- | nailgun_launcher/Stage0Lib.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nailgun_launcher/Stage0Lib.java b/nailgun_launcher/Stage0Lib.java index bd18748..ae09d78 100644 --- a/nailgun_launcher/Stage0Lib.java +++ b/nailgun_launcher/Stage0Lib.java @@ -46,6 +46,12 @@ public class Stage0Lib{ return join( pathSeparator, files ); } + public static File write(File file, String content, OpenOption... options) throws Exception{ + file.getParentFile().mkdirs(); + Files.write(file.toPath(), content.getBytes()); + return file; + } + public static Boolean compile( Boolean changed, Long start, String classpath, String target, EarlyDependencies earlyDeps, List<File> sourceFiles, SecurityManager defaultSecurityManager @@ -82,7 +88,7 @@ public class Stage0Lib{ System.setOut(System.err); int exitCode = runMain( "com.typesafe.zinc.Main", zincArgs.toArray(new String[zincArgs.size()]), earlyDeps.zinc, defaultSecurityManager ); if( exitCode == 0 ){ - Files.write( statusFile.toPath(), "".getBytes()); + write( statusFile, "" ); Files.setLastModifiedTime( statusFile.toPath(), FileTime.fromMillis(start) ); } else { System.exit( exitCode ); |