made_by_roxygen <- function(path) {
  if (!file.exists(path)) {
    return(TRUE)
  }

  first <- read_lines(path, n = 1)
  check_made_by(first)
}

check_made_by <- function(first) {
  if (length(first) == 0L) {
    return(FALSE)
  }
  grepl("^. Generated by roxygen2", first)
}

made_by <- function(comment) {
  # This text is used by IDE to display a special warning. DO NOT CHANGE
  # without consulting the IDE team
  paste0(comment, " Generated by roxygen2: do not edit by hand\n")
}
