diff --git a/R/check_description.R b/R/check_description.R index b32127e4..2301a779 100644 --- a/R/check_description.R +++ b/R/check_description.R @@ -273,12 +273,12 @@ Please send a pull request if you need support for this license.", official <- official[-3] current <- current[-3] } - problems <- c( - problems, - "LICENSE.md doesn't match the version in the checklist package"[ - (length(current) != length(official)) || any(current != official) - ] + if ((length(current) != length(official)) || any(current != official)) { + problems <- c( + problems, "LICENSE.md doesn't match the version in the checklist package" ) + set_license(x) + } x$add_error( errors = problems, item = "license", keep = FALSE diff --git a/R/set_license.R b/R/set_license.R index 0cc71c5f..335d419f 100644 --- a/R/set_license.R +++ b/R/set_license.R @@ -28,7 +28,7 @@ set_license <- function(x = ".") { ) ) |> system.file(package = "checklist") |> - file_copy(license_file) + file_copy(license_file, overwrite = TRUE) if (!grepl("^MIT", this_desc$get_field("License"))) { return(invisible(NULL)) } @@ -46,6 +46,6 @@ set_license <- function(x = ".") { } path("generic_template", "cc_by_4_0.md") |> system.file(package = "checklist") |> - file_copy(license_file) + file_copy(license_file, overwrite = TRUE) return(invisible(NULL)) }