Closed Ilia-Kosenkov closed 1 year ago
I think this is the route cause.
❯ & 'C:\Program Files\R\R-devel\bin\Rscript.exe' -e "dirname('C:/')"
[1] "."
~
❯ & 'C:\Program Files\R\R-4.2.2\bin\Rscript.exe' -e "dirname('C:/')"
[1] "C:/"
~
Because of this, is_root()
fails to recognize C:/
is the root.
https://github.com/r-lib/rprojroot/blob/49a1a644246abcdcbe11a9396b1bb147d0919853/R/root.R#L130-L136
Asked on R-devel.
https://stat.ethz.ch/pipermail/r-devel/2023-February/082370.html
Should be fixed now.
https://github.com/wch/r-source/commit/d444c07b7fe765ce65224faa2e85f0819a189e1a
Thanks for your help on this! Closing, let's open a new issue if similar problems arise in the future.
Hi. While working on
{rextendr}
package we noticed that our tests started to fail onR-devel
on Windows https://github.com/extendr/rextendr/issues/238, specifically a helper method that works on paths relative to the package root. After a couple of days of debugging, I was able to reliably reproduce this issue locally. I suspect that some features that{rprojroot}
relies on work differently in the fresh version ofR-devel
, but I have no idea what that could be, exactly. Here is a minimal reprex:find_package_root_file()
fails with an error stating that no root directory can be foundfind_package_root_file()
does not fail and returns"."
Here are test output on my local system
R-release-windows
``` r pkg_path <- tempfile() tryCatch( { pkg <- usethis::create_package(pkg_path) setwd(pkg) path_outside <- file.path(pkg_path, "..") projroot <- rprojroot::find_package_root_file(path = path_outside) print(projroot) }, finally = unlink(pkg_path) ) #> ✔ Creating 'C:/Users/.../AppData/Local/Temp/RtmpUxTXMV/file48ec7ef85667/' #> ✔ Setting active project to 'C:/Users/.../AppData/Local/Temp/RtmpUxTXMV/file48ec7ef85667' #> ✔ Creating 'R/' #> ✔ Writing 'DESCRIPTION' #> Package: file48ec7ef85667 #> Title: What the Package Does (One Line, Title Case) #> Version: 0.0.0.9000 #> Authors@R (parsed): #> * First LastR-devel-windows
``` r pkg_path <- tempfile() tryCatch( { pkg <- usethis::create_package(pkg_path) setwd(pkg) path_outside <- file.path(pkg_path, "..") projroot <- rprojroot::find_package_root_file(path = path_outside) print(projroot) }, finally = unlink(pkg_path) ) #> ✔ Creating 'C:/Users/.../AppData/Local/Temp/RtmpYD0f5E/file19b07c8de29/' #> ✔ Setting active project to 'C:/Users/.../AppData/Local/Temp/RtmpYD0f5E/file19b07c8de29' #> ✔ Creating 'R/' #> ✔ Writing 'DESCRIPTION' #> Package: file19b07c8de29 #> Title: What the Package Does (One Line, Title Case) #> Version: 0.0.0.9000 #> Authors@R (parsed): #> * First LastIf this is not an issue in
{rprojroot}
but rather in R itself, it would be nice if we could pinpoint it and report it to the devs.