mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
Software Update with apply the settings (Part12)
- Make backup file from downloaded image
- Restore original file, if an error occurs
Origin commit data
------------------
Branch: ni/coolstream
Commit: 48fff4f4db
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-01-01 (Tue, 01 Jan 2013)
Origin message was:
------------------
* Software Update with apply the settings (Part12)
- Make backup file from downloaded image
- Restore original file, if an error occurs
------------------
This commit was generated by Migit
This commit is contained in:
@@ -130,6 +130,7 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str
|
|||||||
|
|
||||||
bool CExtUpdate::applySettings(const std::string & filename, int mode)
|
bool CExtUpdate::applySettings(const std::string & filename, int mode)
|
||||||
{
|
{
|
||||||
|
#define ORGFILE_EXT ".org"
|
||||||
if(!FileHelpers)
|
if(!FileHelpers)
|
||||||
FileHelpers = new CFileHelpers();
|
FileHelpers = new CFileHelpers();
|
||||||
|
|
||||||
@@ -139,11 +140,19 @@ bool CExtUpdate::applySettings(const std::string & filename, int mode)
|
|||||||
imgFilename = FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
|
imgFilename = FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
|
||||||
|
|
||||||
DBG_TIMER_START()
|
DBG_TIMER_START()
|
||||||
|
|
||||||
|
// make backup file
|
||||||
|
FileHelpers->copyFile(imgFilename.c_str(), (imgFilename + ORGFILE_EXT).c_str(), 0644);
|
||||||
|
|
||||||
bool ret = applySettings();
|
bool ret = applySettings();
|
||||||
DBG_TIMER_STOP("Image editing")
|
DBG_TIMER_STOP("Image editing")
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (mtdRamError != "")
|
if (mtdRamError != "")
|
||||||
DisplayErrorMessage(mtdRamError.c_str());
|
DisplayErrorMessage(mtdRamError.c_str());
|
||||||
|
|
||||||
|
// error, restore original file
|
||||||
|
unlink(imgFilename.c_str());
|
||||||
|
rename((imgFilename + ORGFILE_EXT).c_str(), imgFilename.c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (mode == MODE_EXPERT) {
|
if (mode == MODE_EXPERT) {
|
||||||
|
Reference in New Issue
Block a user