Skip to content

Commit

Permalink
Fix path appending
Browse files Browse the repository at this point in the history
  • Loading branch information
GXTX committed Jul 11, 2024
1 parent 5a789e9 commit 7911d34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Includes/CardIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7911d34

Please sign in to comment.