Skip to content

Commit

Permalink
Minor fixes + avoid reading file containing test or calib in their fi…
Browse files Browse the repository at this point in the history
…lename
  • Loading branch information
Rafnuss committed Jan 20, 2025
1 parent b019b25 commit ef5a473
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/tag_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,14 @@ tag_create_detect <- function(file, directory, quiet = TRUE) {
return(file)
}

# Find files in directory ending with `file`
path <- list.files(directory,
pattern = glue::glue(file, "$"),
full.names = TRUE
)

path <- path[!grepl("~\\$", path)]
# Remove temporary file and those with word "test"
path <- path[!grepl("~\\$|test|calib", path, ignore.case = TRUE)]

if (length(path) == 0) {
if (!quiet) {
Expand Down Expand Up @@ -883,7 +885,7 @@ tag_create_dto <- function(sensor_path,

if (any(is.na(df$value))) {
cli::cli_abort(c(
x = "Invalid data in {.file {sensor_path)} at line(s): {20 + which(is.na(df$value))}",
x = "Invalid data in {.file {sensor_path)} at line(s): {skip + which(is.na(df$value))}",
i = "Check and fix the corresponding lines"
))
}
Expand Down

0 comments on commit ef5a473

Please sign in to comment.