tempdir() has 2 forward slashes

Hello,

I have just learnt about the wonderful base-r function tempdir() which can be used for dumping all my csv exports and do not have to remember to create or clean up after the fact! :slight_smile:

But, I see that the output has 2 forward dashes(//) in its path which does not cause any issues in R itself but I cannot paste the same in Mac OSX->Finder->Go To Folder since the 2 dashes do not work.

Is this an intended feature??

Thanks,

Vinay

PS: I have already used gsub() to correct the issue.

Not sure whether it's intended or not, but there are comments on this in the documentation:

For tempdir , the path of the per-session temporary directory.

On Windows, both will use a backslash as the path separator.

On a Unix-alike, the value will be an absolute path (unless tmpdir is set to a relative path), but it need not be canonical (see normalizePath ) and on macOS it often is not.

Check this:

> tempdir_output <- tempdir()
> normalised_tempdir_output <- normalizePath(tempdir_output)
> 
> tempdir_output
[1] "/var/folders/p4/qzqlr4dd6s97ykbwztn90nlwrkzyyg/T//RtmpBs7sMr"
> normalised_tempdir_output
[1] "/private/var/folders/p4/qzqlr4dd6s97ykbwztn90nlwrkzyyg/T/RtmpBs7sMr"
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.