DPL::TaskDecl<TaskRecovery>(this),
m_context(context)
{
+ AddStep(&TaskRecovery::StartStep);
AddStep(&TaskRecovery::StepCreateCheckFile);
+ AddStep(&TaskRecovery::EndStep);
+}
+
+void TaskRecovery::StartStep()
+{
+ LogDebug("--------- <TaskRecovery> : START ----------");
+}
+
+void TaskRecovery::EndStep()
+{
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_CHECK_FILE,
+ "Create information file for recovery");
+
+ LogDebug("--------- <TaskRecovery> : END ----------");
}
void TaskRecovery::StepCreateCheckFile()
{
- LogInfo("Step: create information file for recovery");
+ LogDebug("Step: create information file for recovery");
size_t pos = m_context.locations->getWidgetSource().rfind("/");
std::ostringstream infoPath;
infoPath << GlobalConfig::GetTempInstallInfoPath();
infoPath << "/";
- infoPath << m_context.locations->getWidgetSource().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.locations->getWidgetSource().c_str(), temp);
- if (-1 == fsync(temp->_fileno)) {
- fclose(temp);
- ThrowMsg(Exceptions::InternalError, "Fail to fsync for recovery.");
- }
+ int ret = fsync(temp->_fileno);
fclose(temp);
+ if (-1 == ret) {
+ ThrowMsg(Exceptions::FileOperationFailed, "Fail to fsync for recovery.");
+ }
m_context.installInfo = infoPath.str();
LogDebug("Create file : " << m_context.installInfo);
} else {
- ThrowMsg(Exceptions::InternalError, "Fail to create file for recovery.");
+ ThrowMsg(Exceptions::FileOperationFailed, "Fail to create file for recovery.");
}
-
- m_context.job->SetProgressFlag(true);
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CHECK_FILE,
- "Create information file for recovery");
}
} //namespace WidgetInstall
} //namespace Jobs