Skip to content

Commit 0590514

Browse files
committed
Update update_world.R
1 parent ccfe3e0 commit 0590514

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

R/update_world.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#' @param out_file Destination file to write new worldfile
1313
#' @param overwrite TRUE/FALSE if input worldfile should be overwritten
1414
#' @author Will Burke
15+
#'
1516
#' @export
1617

1718
update_world = function(worldfile, out_file = NULL, vars, values, veg_parm_ID = NULL, level_names = NULL, level_IDs = NULL, overwrite = FALSE) {
@@ -22,8 +23,10 @@ update_world = function(worldfile, out_file = NULL, vars, values, veg_parm_ID =
2223
# - vdouble check all the list options work and check var lengths/numbers when needed
2324

2425
# ---------- Check Aguments ----------
26+
if (!exists(worldfile)) {stop(noquote("Input worldfile is required"))}
27+
if (!file.exists(worldfile)) {stop(noquote(paste0("No file found at", worldfile)))}
2528
if (is.null(out_file) & !overwrite) {stop(noquote("No destination file set by 'out_file' and 'overwrite' is FALSE"))}
26-
if ( file.exists(out_file) & overwrite == FALSE) {stop(noquote(paste0("File '",out_file,"' already exists and 'overwrite' argument is FALSE")))}
29+
if (file.exists(out_file) & overwrite == FALSE) {stop(noquote(paste0("File '",out_file,"' already exists and 'overwrite' argument is FALSE")))}
2730
#if (length(vars) != length(values) & length(values) != 1 & !is.list(values)) {}
2831

2932
# if (!is.list(values)) {
@@ -122,5 +125,4 @@ update_world = function(worldfile, out_file = NULL, vars, values, veg_parm_ID =
122125

123126
print(noquote(paste("Successfully wrote updated worldfile to",out_file)))
124127

125-
126128
}

0 commit comments

Comments
 (0)