From bbf40adf95a2bce26ad58576a20f5858a518434d Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 13 Sep 2022 17:57:31 +0800 Subject: [PATCH 1/2] restore default coins json if user json invalid --- src/core/atomicdex/managers/qt.wallet.manager.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/atomicdex/managers/qt.wallet.manager.cpp b/src/core/atomicdex/managers/qt.wallet.manager.cpp index c2265debe8..15b0f23c6d 100644 --- a/src/core/atomicdex/managers/qt.wallet.manager.cpp +++ b/src/core/atomicdex/managers/qt.wallet.manager.cpp @@ -299,13 +299,24 @@ namespace atomic_dex const std::string wallet_cfg_file = std::string(atomic_dex::get_raw_version()) + "-coins"s + "."s + wallet_name.toStdString() + ".json"s; const fs::path wallet_cfg_path = utils::get_atomic_dex_config_folder() / wallet_cfg_file; + bool valid_json = false; + if (fs::exists(wallet_cfg_path)) + { + QFile ifs; + ifs.setFileName(std_path_to_qstring(wallet_cfg_path)); + ifs.open(QIODevice::ReadOnly | QIODevice::Text); + std::string json_data = QString(ifs.readAll()).toUtf8().constData(); + valid_json = nlohmann::json::accept(json_data); - if (not fs::exists(wallet_cfg_path)) + ifs.close(); + } + + if (!valid_json) { const auto cfg_path = ag::core::assets_real_path() / "config"; std::string filename = std::string(atomic_dex::get_raw_version()) + "-coins.json"; - fs::copy(cfg_path / filename, wallet_cfg_path); + fs::copy(cfg_path / filename, wallet_cfg_path, fs::copy_options::overwrite_existing); } const fs::path seed_path = utils::get_atomic_dex_config_folder() / (wallet_name.toStdString() + ".seed"s); From a747ffdcc8e63241d33a348e1f55b4b243a3a891 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 27 Sep 2022 03:35:11 +0800 Subject: [PATCH 2/2] update ifw --- .github/workflows/atomicdex-desktop-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/atomicdex-desktop-ci.yml b/.github/workflows/atomicdex-desktop-ci.yml index 77c32b9abd..b2ee3f70cc 100644 --- a/.github/workflows/atomicdex-desktop-ci.yml +++ b/.github/workflows/atomicdex-desktop-ci.yml @@ -114,7 +114,7 @@ jobs: - name: Install QT IFW (MacOS) if: runner.os == 'macOS' run: | - python3 -m aqt tool mac tools_ifw 4.4.1 qt.tools.ifw.44 --outputdir ${{ github.workspace }}/Qt + python3 -m aqt tool mac tools_ifw 4.4.2 qt.tools.ifw.44 --outputdir ${{ github.workspace }}/Qt echo "${{ github.workspace }}/Qt/Tools/QtInstallerFramework/4.4/bin" >> $GITHUB_PATH - name: Install QT (Windows) @@ -132,7 +132,7 @@ jobs: if: runner.os == 'Windows' run: | python -m pip install --upgrade pip - python -m aqt tool windows tools_ifw 4.4.1 qt.tools.ifw.44 --outputdir C:/Qt + python -m aqt tool windows tools_ifw 4.4.2 qt.tools.ifw.44 --outputdir C:/Qt echo "C:/Qt/Tools/QtInstallerFramework/4.4/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo $env:GITHUB_PATH echo $env:PATH