From 7911d342f7519941a7ae7568d19517c87cd261dc Mon Sep 17 00:00:00 2001 From: wutno Date: Thu, 14 Mar 2024 19:55:41 -0400 Subject: [PATCH] Fix path appending --- Includes/CardIo.cpp | 10 ++-------- main.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Includes/CardIo.cpp b/Includes/CardIo.cpp index 4081103..20a4c44 100755 --- a/Includes/CardIo.cpp +++ b/Includes/CardIo.cpp @@ -588,6 +588,7 @@ void CardIo::ClearCardData() void CardIo::ReadCard() { std::string fullPath = m_cardSettings->cardPath + m_cardSettings->cardName; + g_logger->debug("CardIo::ReadCard: Reading card data from - {}", fullPath); // TODO: Should we actually be seeding zero's when the file doesn't exist? std::string readBack; @@ -656,15 +657,8 @@ void CardIo::WriteCard() } } -#ifdef _WIN32 - if (m_cardSettings->cardPath.back() != '\\') - m_cardSettings->cardPath.append("\\"); -#else - if (m_cardSettings->cardPath.back() != '/') - m_cardSettings->cardPath.append("/"); -#endif - auto fullPath = m_cardSettings->cardPath + m_cardSettings->cardName; + g_logger->debug("CardIo::WriteCard: Writing card data to {}", fullPath); std::string writeBack; for (const auto &track : cardData) { diff --git a/main.cpp b/main.cpp index 5fb3346..4a1aa4b 100755 --- a/main.cpp +++ b/main.cpp @@ -107,6 +107,14 @@ bool ReadConfig() globalSettings.card.cardPath = ghc::filesystem::current_path().string(); } +#ifdef _WIN32 + if (globalSettings.card.cardPath.back() != '\\') + globalSettings.card.cardPath.append("\\"); +#else + if (globalSettings.card.cardPath.back() != '/') + globalSettings.card.cardPath.append("/"); +#endif + if (lhost.empty()) { globalSettings.webListenHost = "0.0.0.0"; } else {