r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

`dev_mode()` fails with ENOENT when directory does not exist #2467

Closed billdenney closed 1 year ago

billdenney commented 1 year ago

On Windows 11 with R 4.2.1, devtools::dev_mode() fails when the development directory does not exist. Creating the directory first yields success.

devtools::dev_mode()
Error: [ENOENT] Failed to realize 'C:/Users/wdenn/R-dev': no such file or directory
> traceback()
3: (function (..., call. = TRUE, domain = NULL) 
   {
       if (...length() == 1L && inherits(..1, "condition")) {
           cond <- ..1
           if (nargs() > 1L) 
               warning("additional arguments ignored in stop()")
           message <- conditionMessage(cond)
           call <- conditionCall(cond)
           .Internal(.signalCondition(cond, message, call))
           .Internal(.dfltStop(message, call))
       }
       else .Internal(stop(call., .makeMessage(..., domain = domain)))
   })(structure(list(message = "[ENOENT] Failed to realize 'C:/Users/wdenn/R-dev': no such file or directory"), class = c("ENOENT", 
   "fs_error", "error", "condition"), location = "path.cc:21"))
2: path_real(path)
1: devtools::dev_mode()
> dir.create("C:/Users/wdenn/R-dev")
> devtools::dev_mode()
✔ Dev mode: ON
hadley commented 1 year ago

dev_mode() is not a function that we recommend or use any more, so we won't fix this.

billdenney commented 1 year ago

Thanks for letting me know. I didn't see that in the documentation, so I will make a documentation PR to clarify the deprecation.