From murdoch.duncan at gmail.com  Fri Oct  7 12:34:56 2016
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 7 Oct 2016 06:34:56 -0400
Subject: [Rd] unzip does not like a / at the end of path.
In-Reply-To: <CAAjnpdgDHuPDKZPW6-i+WhsN+g=96LRKVnm3ZB3MpZ5rtDV29Q@mail.gmail.com>
References: <CAAjnpdgDHuPDKZPW6-i+WhsN+g=96LRKVnm3ZB3MpZ5rtDV29Q@mail.gmail.com>
Message-ID: <de636419-2658-377d-b05f-7db4a00bf487@gmail.com>

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



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