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

Remove directories after dir(). #100

Closed
wants to merge 1 commit into from
Closed

Remove directories after dir(). #100

wants to merge 1 commit into from

Conversation

wviechtb
Copy link

I am trying out build_site() on a package which has a man/figures directory. I get the error:

Error: The specified pathname is not a file: [...]/man/figures

traceback() shows that this happens due to digest(). In rd.r, I see package_rd(), which uses

rd <- dir(file.path(package$path, "man"), full.names = TRUE)

to get all files in the directory, but this also includes directories themselves (despite include.dirs=FALSE, directories still get included when using a non-recursive listing, which is the default).

So the directories need to be filtered out.

dir() includes directories (despite include.dirs=FALSE, directories still get included when using a non-recursive listing, which is the default). So need to filter out directories (otherwise digest() throws an error when passing a directory to it).
@wviechtb
Copy link
Author

Hmmm, the build failed because the roxygen2 dependency isn't installed. Should that be in Imports?

@@ -20,6 +20,7 @@ package_rd <- function(package) {
package <- as.sd_package(package)

rd <- dir(file.path(package$path, "man"), full.names = TRUE)
rd <- rd[!(rd %in% list.dirs(file.path(package$path, "man"), recursive=FALSE))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about rd <- rd[!dir.exists(rd)] ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, didn't even know this function! Much easier that way.

@hadley hadley closed this in 21c057c Aug 25, 2016
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

Successfully merging this pull request may close these issues.

None yet

2 participants