Closed BarkleyBG closed 6 years ago
Merging #30 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #30 +/- ##
=======================================
Coverage 95.48% 95.48%
=======================================
Files 5 5
Lines 155 155
=======================================
Hits 148 148
Misses 7 7
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 71bd742...c268a9e. Read the comment docs.
Thanks. It feels that this has applications beyond testing: Basically in any situation where you want to lookup files in a known subdirectory. I wonder if we should add a subdir
argument to the make_find_file()
and make_fix_file()
accessors, and extend the vignette accordingly.
I was looking into the guts to see if I could understand the make_find_file()
and make_fix_file()
better. I still don't fully understand all the moving parts, so I don't know if I can respond to your suggestion to add the subdir
argument.
I'd be happy to keep thinking on your comment re: subdir
argument, but I'm not sure how much help I am at this moment.
While I was reading around the guts, I put some pieces together in my understanding of the package, and I thought that it would be good to expand upon the vignette's first example a little bit, which I did here. You'll note that I didn't attempt to mimic the working directory issues by explicity calling setwd()
or anything, but I thought this was a clean-ish way to demonstrate how rprojroot
can help stop the working directory insanity.
In general, my understanding is that rprojroot
has two actions:
file.path()
to specify relative paths from the root to the desired file.
I would imagine you could have a lot of functionality where the directory/tree structure isn't fully known, and you need to blindly search for files that match certain characteristics, but I don't think that's important at the moment. I think that this package should solve the "unknown variable working directory in a known tree/directory structure" problem (for now).
Do you think I've got the right idea here? Perhaps this helps to clarify what the features of the package should be (especially w/r/t the subdir
consideration).
Thanks. Here's what I see:
rprojroot::is_testthat$make_fix_file()
## function (...) {
## file.path("/.../rprojroot/tests/testthat", ...)
## }
What if we had:
rprojroot::is_testthat$make_fix_file(subdir = "testing_data")
## function (...) {
## file.path("/.../rprojroot/tests/testthat", "testing_data", ...)
## }
That would just create the get_my_path()
function:
get_my_path <- rprojroot::is_testthat$make_fix_file(subdir = "testing_data")
I think you have a good understanding of the package's goals, hope the examples made it a bit clearer what I meant with the subdir
argument.
I'm fine with the first part, will merge now and revert partially. Would you like to submit a PR for the second part, maybe after we add support for subdir
?
Decided to also keep the second section, we can tweak once we have a subdir
argument. May I add you as co-author to the vignette?
I'm happy to help moving this along!
subdir
. If it's a nested subdirectory, should subdir
take a list or vector argument? And could this work for e.g.:my_subdir <- c("..", "sister_dir", "sister_subdir")
I'm out of office a little bit right now but would be happy to help where I can later this month. Feel free to tag @ me in issues and I'll respond.
I tried to keep it short and sweet. Let me know what you think?