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

region2/mu-comparison file.access(..., mode=4) fails #90

Open
dylanbeaudette opened this issue Jun 14, 2018 · 0 comments
Open

region2/mu-comparison file.access(..., mode=4) fails #90

dylanbeaudette opened this issue Jun 14, 2018 · 0 comments

Comments

@dylanbeaudette
Copy link
Member

This is a more general problem with file.access() and UNC paths:

\\usda.net\NRCS\Home\CASON\NRCS\Dylan.Beaudette\Desktop\MU-comparison

It seems that the "Desktop" is migrated to this location as part of the transition to Windows 10.

Reading and writing files seems to work, however, testing for read access via file.access() does not work as expected. This is likely to only be a problem when input raster data are stored on a share with UNC path.

The affected code is:

accessible.inputs <- file.access(as.character(unlist(raster.list)), mode = 4) + 1 #file.access returns 0 for success and -1 for failure
if(any( accessible.inputs == 0 )) {
  unreadable.files <- names(which(accessible.inputs == 0))
  stop(paste0("The following input files either do not exist or are unreadable: \n", paste0(unreadable.files, collapse=", ")))
}

A reasonable solution is to test for an existing file (mode=0) as that seems to work.

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

No branches or pull requests

1 participant