From d6860253043918d5b10fa32d659f260bce099123 Mon Sep 17 00:00:00 2001 From: paul bochtler <65470117+datapumpernickel@users.noreply.github.com> Date: Thu, 23 May 2024 15:05:47 +0200 Subject: [PATCH] fix error in ct_migrate_cache towards better accounting for only one of the two dirs being present --- R/utils.R | 9 ++++++--- inst/WORDLIST | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/R/utils.R b/R/utils.R index a875bad..225b755 100644 --- a/R/utils.R +++ b/R/utils.R @@ -71,8 +71,9 @@ ct_migrate_cache <- function(){ cli::cli_abort('x' = 'Something went wrong while copying.') } - fs::dir_delete(rappdirs::user_cache_dir('comtradr')) - + if(fs::dir_exists(rappdirs::user_cache_dir('comtradr'))){ + fs::dir_delete(rappdirs::user_cache_dir('comtradr')) + } ## as above but for the bulk cache directory if((rappdirs::user_cache_dir('comtradr_bulk')!= tools::R_user_dir('comtradr_bulk', which = 'cache')) && @@ -85,7 +86,9 @@ ct_migrate_cache <- function(){ list.files(tools::R_user_dir('comtradr_bulk', which = 'cache')))){ cli::cli_abort('x' = 'Something went wrong while copying.') } - fs::dir_delete(rappdirs::user_cache_dir('comtradr_bulk')) + if(fs::dir_exists(rappdirs::user_cache_dir('comtradr_bulk'))){ + fs::dir_delete(rappdirs::user_cache_dir('comtradr_bulk')) + } } #' Get reference table from package data diff --git a/inst/WORDLIST b/inst/WORDLIST index 0d69309..5e14081 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,6 +1,7 @@ ASEAN CMD COMTRADE +Comtrade Codecov Comtrade EB