Skip to content

Commit

Permalink
refactor: if data is filename improve handling of fileext parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed Jan 12, 2024
1 parent b6d623d commit 4cb4fac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/read_sf_ext.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ read_sf_pkg <- function(data,
...) {
fileext <- fileext %||% filetype
package <- package %||% pkg

check_string(package, allow_empty = FALSE)
check_installed(package)
check_string(
Expand All @@ -125,6 +126,12 @@ read_sf_pkg <- function(data,
return(use_eval_parse(data = data, package = package))
}

data_fileext <- str_extract_fileext(data)

if (!is.na(data_fileext) && (data_fileext != fileext)) {
fileext <- data_fileext
}

filename <- str_add_fileext(data, fileext = fileext)

path <- dplyr::case_when(
Expand Down

0 comments on commit 4cb4fac

Please sign in to comment.