@@ -450,25 +450,27 @@ check.settings <- function(settings, force = FALSE) {
450450 }
451451
452452 # Check folder where outputs are written before adding to dbfiles
453- if (is.null(settings $ database $ dbfiles )) {
454- settings $ database $ dbfiles <- PEcAn.utils :: full.path(" ~/.pecan/dbfiles" )
455- } else {
456- if (substr(settings $ database $ dbfiles , 1 , 1 ) != " /" ) {
457- PEcAn.logger :: logger.warn(
458- " settings$database$dbfiles pathname" , settings $ database $ dbfiles ,
459- " is invalid\n " ,
460- " placing it in the home directory " ,
461- Sys.getenv(" HOME" ))
462- settings $ database $ dbfiles <- file.path(
463- Sys.getenv(" HOME" ),
464- settings $ database $ dbfiles )
465- }
453+ if (! is.null(settings $ database )) {
454+ if (is.null(settings $ database $ dbfiles )) {
455+ settings $ database $ dbfiles <- PEcAn.utils :: full.path(" ~/.pecan/dbfiles" )
456+ } else {
457+ if (substr(settings $ database $ dbfiles , 1 , 1 ) != " /" ) {
458+ PEcAn.logger :: logger.warn(
459+ " settings$database$dbfiles pathname" , settings $ database $ dbfiles ,
460+ " is invalid\n " ,
461+ " placing it in the home directory " ,
462+ Sys.getenv(" HOME" ))
463+ settings $ database $ dbfiles <- file.path(
464+ Sys.getenv(" HOME" ),
465+ settings $ database $ dbfiles )
466+ }
466467
467- settings $ database $ dbfiles <- normalizePath(
468- settings $ database $ dbfiles ,
469- mustWork = FALSE )
468+ settings $ database $ dbfiles <- normalizePath(
469+ settings $ database $ dbfiles ,
470+ mustWork = FALSE )
471+ }
472+ dir.create(settings $ database $ dbfiles , showWarnings = FALSE , recursive = TRUE )
470473 }
471- dir.create(settings $ database $ dbfiles , showWarnings = FALSE , recursive = TRUE )
472474
473475 # check all inputs exist
474476 settings <- papply(settings , check.inputs )
0 commit comments