You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
5
5
* Add `wbt_runner_path()` (analog of `wbt_exe_path()` for `whitebox_runner` GUI executable) and `wbt_launch_runner()` a simple function to launch the GUI.
6
6
7
+
*`wbt_wd("")` now sets the value of `working_directory` in the WhiteboxTools settings.json file to `""` and triggers background options to prevent `--wd` flag being added until a new working directory is set. This has been a long-standing issue, resolved following <https://github.com/opengeos/whiteboxR/issues/108>.
8
+
7
9
# whitebox 2.3.0
8
10
9
11
* Updates for WhiteboxTools v2.3.0 (https://github.com/jblindsay/whitebox-tools/releases/tag/v2.3.0)
#' @return `wbt_wd()`: character; when working directory is unset, will not add `--wd=` arguments to calls and should be the same as using `getwd()`. See Details.
290
295
#'
291
-
#' @details `wbt_wd()`: Before you set the working directory in a session the default output will be in your current R working directory unless otherwise specified. You can change working directory at any time by setting the `wd` argument to `wbt_wd()` and running a tool. Note that once you have set a working directory, the directory needs to be set somewhere to "replace" the old value; just dropping the flag will not change the working directory back to the R working directory. To "unset" the option in the R package you can use `wbt_wd("")` which is equivalent to `wbt_wd(getwd())`.
296
+
#' @details `wbt_wd()`: Before you set the working directory in a session the default output will be in your current R working directory unless otherwise specified. You can change working directory at any time by setting the `wd` argument to `wbt_wd()` and running a tool. Note that once you have set a working directory, the directory needs to be set somewhere to "replace" the old value; just dropping the flag will not change the working directory back to the R working directory. To "unset" the option in the R package you can use `wbt_wd("")` which removes the `--wd` flag from commands and sets the `working_directory` value in the WhiteboxTools _settings.json_ to `""`.
292
297
#' @rdname wbt_init
293
298
#' @export
294
299
#' @keywords General
295
300
#' @examples
296
301
#' \dontrun{
297
302
#'
298
303
#' ## wbt_wd():
299
-
#'
304
+
#'
305
+
#' # no working directory set
306
+
#' wbt_wd(wd = "")
307
+
#'
300
308
#' # set WBT working directory to R working directory
301
309
#' wbt_wd(wd = getwd())
302
310
#' }
303
311
wbt_wd<-function(wd=NULL) {
304
312
305
-
# system environment var takes precedence
306
-
syswd<- Sys.getenv("R_WHITEBOX_WD")
307
-
if (nchar(syswd) >0&& dir.exists(syswd)) {
308
-
return(syswd)
309
-
}
310
-
311
313
if (length(wd) >0&& (is.na(wd) ||wd=="")) {
312
-
curwd<- getwd()
313
-
if(wbt_verbose()) {
314
-
cat("Reset WhiteboxTools working directory to current R working directory:", curwd)
0 commit comments