r-lib / archive

R bindings to libarchive, supporting a large variety of archive formats
https://archive.r-lib.org/
Other
145 stars 17 forks source link

archive_write_dir() creates empty archive #69

Closed gaborcsardi closed 2 years ago

gaborcsardi commented 2 years ago

Relative path (?) to the directory fails:

library(archive)
dir.create(d <- "files")

write.csv(iris, file.path(d, "iris.csv"))
write.csv(mtcars, file.path(d, "mtcars.csv"))
write.csv(airquality, file.path(d, "airquality.csv"))

a <- archive_write_dir("data.zip", d)
a
#> # A tibble: 0 × 3
#> # … with 3 variables: path <chr>, size <int>, date <dttm>
dir("data.zip")
#> character(0)

Created on 2022-01-28 by the reprex package (v2.0.1)

But on Windows absolute paths fail as well:

library(archive)
dir.create(d <- "files")

write.csv(iris, file.path(d, "iris.csv"))
write.csv(mtcars, file.path(d, "mtcars.csv"))
write.csv(airquality, file.path(d, "airquality.csv"))

a <- archive_write_dir("data.zip", file.path(getwd(), d))
a
#> # A tibble: 0 × 3
#> # … with 3 variables: path <chr>, size <int>, date <dttm>

Created on 2022-01-28 by the reprex package (v2.0.1)

gaborcsardi commented 2 years ago

Closed by bb14f0c093106d91f8553844657c62a669abdd87