* Software Update with apply the settings (Part2)

- Use g_settings.update_dir for directory Expert functions
This commit is contained in:
micha-bbg
2012-04-18 20:55:20 +02:00
parent b001b36f4a
commit f0463c3044
2 changed files with 7 additions and 6 deletions

View File

@@ -121,7 +121,7 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str
bool CExtUpdate::writemtdExt(const std::string & filename) bool CExtUpdate::writemtdExt(const std::string & filename)
{ {
imgFilename = "/tmp/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename); imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
DBG_TIMER_START() DBG_TIMER_START()
bool ret = writemtdExt(); bool ret = writemtdExt();
DBG_TIMER_STOP("Image bearbeiten") DBG_TIMER_STOP("Image bearbeiten")
@@ -446,6 +446,7 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
size_t pos; size_t pos;
while(fgets(buf, sizeof(buf), f1) != NULL) { while(fgets(buf, sizeof(buf), f1) != NULL) {
std::string line = buf; std::string line = buf;
// remove comments
line = trim(line); line = trim(line);
if (line.find_first_of("#") == 0) if (line.find_first_of("#") == 0)
continue; continue;
@@ -476,8 +477,8 @@ bool CExtUpdate::readBackupList(const std::string & dstPath)
std::string dst = dstPath + line; std::string dst = dstPath + line;
if ((line.find("*") != std::string::npos) || (line.find("?") != std::string::npos)) { if ((line.find("*") != std::string::npos) || (line.find("?") != std::string::npos)) {
// Wildcards // Wildcards
WRITE_UPDATE_LOG("\n");
DBG_MSG("Wildcards: %s\n", dst.c_str()); DBG_MSG("Wildcards: %s\n", dst.c_str());
WRITE_UPDATE_LOG("\n");
WRITE_UPDATE_LOG("--------------------\n"); WRITE_UPDATE_LOG("--------------------\n");
WRITE_UPDATE_LOG("Wildcards: %s\n", dst.c_str()); WRITE_UPDATE_LOG("Wildcards: %s\n", dst.c_str());
copyFileList(line, dstPath); copyFileList(line, dstPath);

View File

@@ -534,11 +534,11 @@ void CFlashExpert::readmtd(int preadmtd)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
strftime(tmpStr, sizeof(tmpStr), "_%Y%m%d_%H%M.img", localtime(&tv.tv_sec)); strftime(tmpStr, sizeof(tmpStr), "_%Y%m%d_%H%M.img", localtime(&tv.tv_sec));
CMTDInfo* mtdInfo = CMTDInfo::getInstance(); CMTDInfo* mtdInfo = CMTDInfo::getInstance();
std::string filename = "/tmp/" + mtdInfo->getMTDName(preadmtd); std::string filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd);
filename += tmpStr; filename += tmpStr;
if (preadmtd == -1) { if (preadmtd == -1) {
filename = "/tmp/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1) filename = (std::string)g_settings.update_dir + "/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1)
preadmtd = MTD_OF_WHOLE_IMAGE; preadmtd = MTD_OF_WHOLE_IMAGE;
} }
setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH); setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH);
@@ -585,7 +585,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber)
CFlashTool ft; CFlashTool ft;
ft.setStatusViewer( this ); ft.setStatusViewer( this );
ft.setMTDDevice( CMTDInfo::getInstance()->getMTDFileName(mtdNumber) ); ft.setMTDDevice( CMTDInfo::getInstance()->getMTDFileName(mtdNumber) );
if(!ft.program( "/tmp/" + filename, 50, 100)) { if(!ft.program( (std::string)g_settings.update_dir + "/" + filename, 50, 100)) {
showStatusMessageUTF(ft.getErrorMessage()); // UTF-8 showStatusMessageUTF(ft.getErrorMessage()); // UTF-8
sleep(10); sleep(10);
} else { } else {
@@ -634,7 +634,7 @@ void CFlashExpert::showFileSelector(const std::string & actionkey)
fileselector->addIntroItems(LOCALE_FLASHUPDATE_FILESELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); fileselector->addIntroItems(LOCALE_FLASHUPDATE_FILESELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
struct dirent **namelist; struct dirent **namelist;
int n = scandir("/tmp", &namelist, 0, alphasort); int n = scandir(g_settings.update_dir, &namelist, 0, alphasort);
if (n < 0) if (n < 0)
{ {
perror("no flashimages available"); perror("no flashimages available");