Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work Around R Windows Bug: Directories with Trailing Slashes Don't Work #855

Closed
billdenney opened this issue May 1, 2019 · 1 comment
Closed

Comments

@billdenney
Copy link
Contributor

A long-standing bug in R for Windows is that slashes at the end of directory names aren't handled correctly. What I'm reporting below is that R windows bug that is viewed as not to be fixed (https://bugs.r-project.org/bugzilla/show_bug.cgi?id=14721, see bottom of this issue report), but it causes problems with drake and has a simple work-around.

Directory names with trailing slashes appear not to exist while directories without trailing slashes work correctly. Wherever this issue occurs in drake, wrapping the directory name with file.path() will chop off the trailing slash and make it work correctly.

library(drake)

dir.create("c:/tmp/t", recursive=TRUE, showWarnings=FALSE)
make(drake_plan(list.files(path=file_in("c:/tmp/t"))))
#> target drake_target_1
make(drake_plan(list.files(path=file_in("c:/tmp/t/"))))
#> Warning: missing input files:
#>   c:/tmp/t/
#> target drake_target_1

Created on 2019-04-30 by the reprex package (v0.2.1)

The windows inconsistency illustrated:

> file.exists("c:/tmp/")
[1] FALSE
> file.exists("c:/tmp")
[1] TRUE
@wlandau
Copy link
Member

wlandau commented May 1, 2019

Thanks, @billdenney. Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants