Skip to content

Commit

Permalink
0.9.8: exit gracefully when input directory empty or does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrug committed Oct 21, 2021
1 parent 700e8eb commit 538df15
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: LEEF.measurement.manualcount
Type: Package
Title: Pre-Process and Extract Manualcount
Version: 0.9.7
Version: 0.9.8
Authors@R: c(
person(given = "Rainer M.", family = "Krug", email = "[email protected]", role = c("aut", "cre")),
person("SNF Project 310030_188431", role = "fnd")
Expand Down
7 changes: 7 additions & 0 deletions R/extractor_manualcount.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ extractor_manualcount <- function( input, output ) {
recursive = TRUE,
showWarnings = FALSE
)
if ( length( list.files( file.path(input, "manualcount") ) ) == 0 ) {
message("\nEmpty or missing manualcount directory - nothing to do.\n")
message("\ndone\n")
message("########################################################\n")
return(invisible(TRUE))
}

loggit::set_logfile(file.path(output, "manualcount", "manualcount.log"))

message("\n########################################################\n")
Expand Down
14 changes: 7 additions & 7 deletions R/pre_processor_manualcount.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ pre_processor_manualcount <- function(
input,
output
) {
if ( length( list.files( file.path(input, "manualcount") ) ) == 0 ) {
message("\nEmpty or missing manualcount directory - nothing to do.\n")
message("\ndone\n")
message("########################################################\n")
return(invisible(TRUE))
}

dir.create(
file.path(output, "manualcount"),
recursive = TRUE,
Expand All @@ -26,13 +33,6 @@ pre_processor_manualcount <- function(
message("\nProcessing manualcount\n")
##

if ( length( list.files( file.path(input, "manualcount") ) ) == 0 ) {
message("\nEmpty or missing manualcount directory - nothing to do.\n")
message("\ndone\n")
message("########################################################\n")
return(invisible(TRUE))
}

fns <- list.files(
path = file.path(input, "manualcount"),
pattern = "\\.xlsx$",
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"codeRepository": "https://github.com/LEEF-UZH/LEEF.measurement.manualcount",
"issueTracker": "https://github.com/LEEF-UZH/LEEF.measurement.manualcount/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.9.7",
"version": "0.9.8",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -124,5 +124,5 @@
}
],
"readme": "https://github.com/LEEF-UZH/LEEF.measurement.manualcount/blob/master/Readme.md",
"fileSize": "15.034KB"
"fileSize": "15.312KB"
}

0 comments on commit 538df15

Please sign in to comment.