Closed stefanoborini closed 1 year ago
Seems like command line zip treats .
specially, and leaves the actual .
directory out of the archive. This is a workaround to get that behaviour:
zip::zip(
"../out.zip",
dir(all.files=TRUE, no.. = TRUE),
mode="cherry-pick",
include_directories = FALSE
)
zip_list("../out.zip")$filename
#> [1] "bar" "foo"
It would be reasonable to change the meaning of .
, at least for mode = "cherry-pick"
, although strictly speaking it would be a breaking change for R.
I'll need to test a bit if this breaks anything (unlikely imo), and if not then we can keep it.
Seems like it'll be OK.
Imagine having a directory xxx, containing files foo and bar.
invoking
is supposed to produce a file containing the files in the base of the zip file, but this is not the case. The xxx prefix is left there.
This means that the above and the following exhibit the same behaviour, when they are not supposed to:
The only way to create these packages is to list the files one by one, or to take and hide the warning by not using cherry pick mode. Still, the resulting file contains ./ as a prefix.
The expected behavior is that this one
produces an archive with foo and bar, exactly like zip -r behaves from the command line