Skip to content

Commit

Permalink
add 5 phto tags to fpr_photo_rename
Browse files Browse the repository at this point in the history
- use `fs::dir_create` in `fpr_photo_folders`
  • Loading branch information
NewGraphEnvironment committed Oct 29, 2024
1 parent b8a864c commit c73431b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Development version
- add 5 phto tags to `fpr_photo_rename`
- use `fs::dir_create` in `fpr_photo_folders`
- `include.dirs = FALSE` and `recursive = FALSE` within `fpr_photo_paths_to_copy` so we don't snag out on sub-directories. Don't think it will be a problem
as we just look one level within directories anyway.

Expand Down
10 changes: 8 additions & 2 deletions R/photo.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ fpr_photo_resize_batch <- function(dir_source = NULL,
#'
#' @param site String - number of site to build folder for
#' @param path String - path stub where photos directories are held
#'
#' @importFrom fs dir_create
#' @return Makes directories
#' @family photo
#' @export
#'
#' @examples
fpr_photo_folders <- function(site, path = 'data/photos/'){
dir.create(paste0(path, site), recursive = TRUE)
fs::dir_create(fs::path(path, site), recurse = TRUE)
}


Expand Down Expand Up @@ -641,6 +641,12 @@ fpr_photo_rename <- function(dat = form_pscis,
janitor::make_clean_names(photo_extra1_tag, allow_dupes = T, sep_out = ''),
stringr::str_detect(photo_renamed, 'photo_extra2') ~
janitor::make_clean_names(photo_extra2_tag, allow_dupes = T, sep_out = ''),
stringr::str_detect(photo_renamed, 'photo_extra3') ~
janitor::make_clean_names(photo_extra3_tag, allow_dupes = T, sep_out = ''),
stringr::str_detect(photo_renamed, 'photo_extra4') ~
janitor::make_clean_names(photo_extra4_tag, allow_dupes = T, sep_out = ''),
stringr::str_detect(photo_renamed, 'photo_extra5') ~
janitor::make_clean_names(photo_extra5_tag, allow_dupes = T, sep_out = ''),
T ~ photo_renamed),
photo_renamed = stringr::str_replace_all(photo_renamed, 'photo_', ''))
# generalize above
Expand Down

0 comments on commit c73431b

Please sign in to comment.