Clarify difference between "find" and "fix" functions in vignette
krlmlr opened this issue · 4 comments
Basically, the ...find...() functions look at the current working directory, while the ...fix...() functions don't.
@egouldo: Look at the result of rprojroot::is_r_package$make_fix_file()
. How to make this clear in the vignette?
Okay, I've just updated my version of the package so I can run the suggested code above. I can see that rprojroot::is_r_package$find_file()
returns the path of the root dir. of my package, whereas rprojroot::is_r_package$make_fix_file()
returns a function that appends any arguments I supply to the root dir file path. Cool. So as per your documentation, I can define my own function and use it as a wrapper where needed. Is that the main difference, or am I missing something still?
Also, not sure if intended or not, but the functions make_find_root_file
and make_fix_root_file
no longer seem to be exported in the rprojroot namespace (but there is still reference to these functions within the 'Details' section of the ?find_root_file page).
$find_file()
also takes an arbitrary number of arguments. If you define your own function, it's one of the two below:
root <- rprojroot::is_r_package$find_file
root <- rprojroot::is_r_package$make_fix_file()
The make_()
functions are gone and replaced by their object-oriented counterpart, this is intended. Thanks for the hint, I'll update the documentation.
There is a subtle difference between the two options above, too. The first version (find_file
) will search for a project root from the current directory every time. The second version (make_fix_file()
) looks for the project root once (when defining root
), and then keeps that root no matter what the current working directory is.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.