Skip to content

Commit

Permalink
fix: store sticker in figures/readme - fix #62
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Sep 24, 2024
1 parent e0aeda0 commit 4ba5f3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
23 changes: 18 additions & 5 deletions R/utils-io.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,30 @@ add_sticker <- function(type, overwrite = FALSE, quiet = FALSE) {

stop_if_not_logical(overwrite, quiet)

path <- file.path(path_proj(), "man", "figures", paste0(type, "-sticker.png"))
if (type == "package") {

path <- file.path(path_proj(), "man", "figures",
paste0(type, "-sticker.png"))

pathdir <- file.path("man", "figures")

} else {

path <- file.path(path_proj(), "figures", "readme",
paste0(type, "-sticker.png"))

pathdir <- file.path("figures", "readme")
}

if (file.exists(path) && !overwrite) {

stop(paste0("A 'man/figures/", type, "-sticker.png' is already present. ",
"If you want to replace it, please use `overwrite = TRUE`."))
stop(paste0("A '", pathdir, "/", type, "-sticker.png' is already present. ",
"If you want to replace it, please use `overwrite = TRUE`."))
}


if (!dir.exists(file.path(path_proj(), "man", "figures")))
dir.create(file.path(path_proj(), "man", "figures"), showWarnings = FALSE,
if (!dir.exists(file.path(path_proj(), pathdir)))
dir.create(file.path(path_proj(), pathdir), showWarnings = FALSE,
recursive = TRUE)

invisible(
Expand Down
4 changes: 2 additions & 2 deletions inst/templates/README-comp.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ output: github_document
```{r, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
fig.path = "figures/readme/",
out.width = "100%")
```



{{project_name}} <img src="man/figures/compendium-sticker.png" align="right" style="float:right; height:120px;"/>
{{project_name}} <img src="figures/readme/compendium-sticker.png" align="right" style="float:right; height:120px;"/>
=========================================================

<!-- badges: start -->
Expand Down

0 comments on commit 4ba5f3e

Please sign in to comment.