#include <dpl/foreach.h>
#include <dpl/wrt-dao-ro/widget_config.h>
-#include <dpl/utils/file_utils.h>
#include <dpl/utils/wrt_utility.h>
#include <widget_install/job_widget_install.h>
#include <widget_install/widget_install_context.h>
{
LogInfo("Step: create information file for recovery");
- std::string fileName;
- size_t pos = m_context.widgetSource.rfind("/");
+ size_t pos = m_context.locations->getWidgetSource().rfind("/");
std::ostringstream infoPath;
infoPath << GlobalConfig::GetTempInstallInfoPath();
infoPath << "/";
- infoPath << m_context.widgetSource.substr(pos+1);
+ infoPath << m_context.locations->getWidgetSource().substr(pos+1);
FILE *temp = fopen(infoPath.str().c_str(), "w+");
if (temp != NULL) {
- fputs(m_context.widgetSource.c_str(), temp);
- fsync(temp->_fileno);
+ fputs(m_context.locations->getWidgetSource().c_str(), temp);
+ if (-1 == fsync(temp->_fileno)) {
+ fclose(temp);
+ ThrowMsg(Exceptions::InternalError, "Fail to fsync for recovery.");
+ }
fclose(temp);
m_context.installInfo = infoPath.str();