From d65b6ebb805a87798004c46b22581aa991d5f158 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Sun, 8 Apr 2012 14:05:18 +0000 Subject: [PATCH] * Softupdate: Generate file name from mtd name - Time stamp added to file name git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2197 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/update.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index f2d3f3713..0032baf5f 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -529,11 +529,13 @@ CFlashExpert::CFlashExpert() void CFlashExpert::readmtd(int preadmtd) { - char tmp[10]; - sprintf(tmp, "%d", preadmtd); - std::string filename = "/tmp/mtd"; - filename += tmp; - filename += ".img"; // US-ASCII (subset of UTF-8 and ISO8859-1) + char tmpStr[256]; + struct timeval tv; + gettimeofday(&tv, NULL); + strftime(tmpStr, sizeof(tmpStr), "_%Y%m%d_%H%M.img", localtime(&tv.tv_sec)); + CMTDInfo* mtdInfo = CMTDInfo::getInstance(); + std::string filename = "/tmp/" + mtdInfo->getMTDName(preadmtd); + filename += tmpStr; if (preadmtd == -1) { filename = "/tmp/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1) @@ -542,10 +544,10 @@ void CFlashExpert::readmtd(int preadmtd) setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH); paint(); showGlobalStatus(0); - showStatusMessageUTF((std::string(g_Locale->getText(LOCALE_FLASHUPDATE_ACTIONREADFLASH)) + " (" + CMTDInfo::getInstance()->getMTDName(preadmtd) + ')')); // UTF-8 + showStatusMessageUTF((std::string(g_Locale->getText(LOCALE_FLASHUPDATE_ACTIONREADFLASH)) + " (" + mtdInfo->getMTDName(preadmtd) + ')')); // UTF-8 CFlashTool ft; ft.setStatusViewer( this ); - ft.setMTDDevice(CMTDInfo::getInstance()->getMTDFileName(preadmtd)); + ft.setMTDDevice(mtdInfo->getMTDFileName(preadmtd)); if(!ft.readFromMTD(filename, 100)) { showStatusMessageUTF(ft.getErrorMessage()); // UTF-8