From fdc2c0aedc0cc7e8436bd9fdebf96268e90b7588 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sat, 6 Aug 2022 21:23:13 +0800 Subject: [PATCH] Fix path issue in Android --- UI/GameScreen.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 69fe589d99..2bad506283 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -46,7 +46,7 @@ #include "Core/Reporting.h" #include "Common/Crypto/md5.h" #include - +#include GameScreen::GameScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) { //g_BackgroundAudio.SetGame(gamePath); @@ -464,19 +464,17 @@ std::string MD5_262144_File(const Path filename) { UI::EventReturn GameScreen::OnDoMD5(UI::EventParams& e) { MD5string = ""; + std::string tmpstr = gamePath_.GetFilename(); + size_t pos = tmpstr.rfind('/'); + tmpstr = tmpstr.substr(pos + 1); + MD5string = MD5FullFile(gamePath_) + "#"; - - - - if (sfilesize <= 262144) { - MD5string = MD5string + MD5FullFile(gamePath_); - } - else { - MD5string = MD5string + MD5_262144_File(gamePath_); - } - MD5string = MD5string + "#" + std::to_string(sfilesize) + "#"+ gamePath_.GetFilename(); + MD5string = MD5string + MD5_262144_File(gamePath_); + MD5string = MD5string + "#" + std::to_string(sfilesize) + "#" + tmpstr; + btnCalcMD5_->SetEnabled(false); tvMD5_->SetText(MD5string); + return UI::EVENT_DONE; }