diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy index 6a14192b..25318104 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy @@ -80,11 +80,17 @@ ${meta['workflow']['stats']['processes']} static void writeString(String text, QuiltPackage pkg, String filename) { String dir = pkg.packageDest() Path path = Paths.get(dir, filename.split('/') as String[]) + File parent = path.getParent().toFile() + if (parent != null && !parent.exists() && !parent.mkdirs()) { + throw new IllegalStateException("Couldn't create dir: " + parent); + } + try { Files.write(path, text.bytes) } catch (Exception e) { - log.error("writeString: cannot write `$text` to `$path` for `${pkg}`") + log.error("writeString[${e.getMessage()}]: fail write `$path` for `${pkg}`") + e.printStackTrace() } } diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/jep/QuiltPackageTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/jep/QuiltPackageTest.groovy index 87a273f8..fdf77d74 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/jep/QuiltPackageTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/jep/QuiltPackageTest.groovy @@ -91,7 +91,6 @@ class QuiltPackageTest extends QuiltSpecification { String filename = 'test.txt' Path installPath = pkg.packageDest() Path tempFile = File.createTempFile('test', '.txt').toPath() - println("tempFile: "+tempFile); Path installedFile = Paths.get(installPath.toString(), filename) expect: Files.exists(tempFile)