[Rd] unzip does not like a / at the end of path.

Duncan Murdoch murdoch.duncan at gmail.com
Fri Oct 7 12:34:56 CEST 2016


On 07/10/2016 6:18 AM, Witold E Wolski wrote:
> dir("inst/extdata/")
> dir("./inst/extdata/")
> dir("inst/extdata")
>
> works all fine, listing the directory content.
>
> but:
>
> unzip(tmp[1],exdir = "inst/extdata/")
> Error in unzip(tmp[1], exdir = "inst/extdata/") : 'exdir' does not exist
> unzip(tmp[1],exdir = "./inst/extdata/")
> Error in unzip(tmp[1], exdir = "inst/extdata/") : 'exdir' does not exist
>
> only
> unzip(tmp[1],exdir = "inst/extdata")
> does work.
>
> Somehow inconsistent isn't it?
>
>

You don't say what platform you're working on, but I'd guess Windows, 
because on Windows "inst/extdata/" (or "inst\extdata\") is not a valid 
path.  The dir() function works around this issue by removing trailing 
slashes as appropriate, but unzip() passes the work to an external 
utility, and it is stricter about enforcing the rules of the platform.

Duncan Murdoch



More information about the R-devel mailing list