From d14923ae1ac023c8f8f5ae8b5c0884f4247f764b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 4 Feb 2016 18:06:15 +0100 Subject: Test reading .out files and close connections --- pkg/R/TOXSWA_cwa.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'pkg/R/TOXSWA_cwa.R') diff --git a/pkg/R/TOXSWA_cwa.R b/pkg/R/TOXSWA_cwa.R index a693dc1..d2720a9 100644 --- a/pkg/R/TOXSWA_cwa.R +++ b/pkg/R/TOXSWA_cwa.R @@ -187,6 +187,7 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", "integer", rep("numeric", 5)), col.names = c("datetime", "t", "segment", "xcd", "cwa_tot", "cwa", "Xss", "Xmp"))) + if (is.null(zipfile)) close(file_connection) # only needed for files if (!inherits(cwa_all_segments, "try-error")) { @@ -219,9 +220,7 @@ TOXSWA_cwa <- R6Class("TOXSWA_cwa", # out file from FOCUS TOXSWA 4 (TOXSWA 4.4.2 or similar) outfile <- try(readLines(file_connection)) - if (is.null(zipfile)) { - close(file_connection) # only needed for files - } + close(file_connection) # only needed for files if (inherits(outfile, "try-error")) { stop("Could not read ", filename) -- cgit v1.2.1