From b8667fc29a5d9bb0855f6a35ddbfb5e5500180d8 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 6 Apr 2023 16:08:06 -0500 Subject: [PATCH] fix backup behavior when backup is open --- src/gui/gui.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 90aaf31bb..15850e2f3 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5470,13 +5470,17 @@ bool FurnaceGUI::loop() { backupTimer=(backupTimer-ImGui::GetIO().DeltaTime); if (backupTimer<=0) { backupTask=std::async(std::launch::async,[this]() -> bool { + logV("backupPath: %s",backupPath); + logV("curFileName: %s",curFileName); if (curFileName.find(backupPath)==0) { logD("backup file open. not saving backup."); + backupTimer=30.0; return true; } if (!dirExists(backupPath.c_str())) { if (!makeDir(backupPath.c_str())) { logW("could not create backup directory!"); + backupTimer=30.0; return false; } } @@ -5959,7 +5963,11 @@ bool FurnaceGUI::init() { } strncpy(finalLayoutPath,(e->getConfigPath()+String(LAYOUT_INI)).c_str(),4095); - backupPath=e->getConfigPath()+String(BACKUPS_DIR); + backupPath=e->getConfigPath(); + if (backupPath.size()>0) { + if (backupPath[backupPath.size()-1]==DIR_SEPARATOR) backupPath.resize(backupPath.size()-1); + } + backupPath+=String(BACKUPS_DIR); prepareLayout(); ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_DockingEnable;