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

2016-10-07 Thread Witold E Wolski
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?


-- 
Witold Eryk Wolski

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2016-10-07 Thread Duncan Murdoch

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel