From 814f5d85fe2e92cf166de042aa42a50102bce763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu> Date: Mon, 9 Mar 2020 11:11:50 +0100 Subject: [PATCH] Substitute state handling code in the reset widget with function calls --- R/shinyUI.R | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/R/shinyUI.R b/R/shinyUI.R index 42f5bd9..99fb5be 100644 --- a/R/shinyUI.R +++ b/R/shinyUI.R @@ -1525,19 +1525,10 @@ mk_shinyscreen <- function(projDir=getwd(), pDir <- rvConf$projDir shiny::req(rvTab$mtr,pDir,rvConf$fnFT) post_note('Started cleaning up state.') - pref<-bak_fstate_pref() - fnCurr <- paste0(file.path(pDir,pref), - rvConf$fnFT,'.current.bak.csv') - fnLast <- paste0(file.path(pDir,pref), - rvConf$fnFT,'.prev.bak.csv') - tab2file(tab=rvTab$mtr,file=fnCurr) + fnCurr<-save_state(pDir,fnState=rvConf$fnFT,rvTab$mtr) post_note(paste('Current state backed up to ',fnCurr,' .',sep='')) - maybeSaved <- file.path(pDir,rvConf$fnFT) - if (isThingFile(maybeSaved)) { - file.copy(maybeSaved,fnLast) - post_note(paste('Also, last saved state backed up to ',fnLast,' .',sep='')) - unlink(maybeSaved,force = T) - } + fnLast <- save_prev_state(pDir,rvConf$fnFT) + if (!is.null(fnLast)) post_note(paste('Also, last saved state backed up to ',fnLast,' .',sep='')) rvTab$mtr<-NULL post_note('State is now less dirty.') }) -- GitLab