#include <dpl/localization/LanguageTagsProvider.h>
#define DEFAULT_ICON_NAME "icon.png"
+#define DEFAULT_PREVIEW_NAME "preview.png"
using namespace WrtDB;
if (preview.empty()) {
continue;
}
- // copy preview image to shared directory
sourceFile << m_context.locations->getSourceDir() << "/";
sourceFile << preview;
targetFile << m_context.locations->getSharedDataDir() << "/";
targetFile << (**boxIt).m_liveboxId << ".";
- targetFile << DPL::ToUTF8String((*sizeIt).m_size) << ".preview.png";
+ targetFile << DPL::ToUTF8String((*sizeIt).m_size) << "." << DEFAULT_PREVIEW_NAME;
- DPL::FileInput input(sourceFile.str());
- DPL::FileOutput output(targetFile.str());
- DPL::Copy(&input, &output);
+ DynamicBoxFileCopy(sourceFile.str(), targetFile.str(), preview);
// clear stream objects
sourceFile.str("");
if (icon.empty()) {
continue;
}
- // copy icon to shared directory
sourceFile << m_context.locations->getSourceDir() << "/";
sourceFile << icon;
targetFile << m_context.locations->getSharedDataDir() << "/";
- targetFile << (**boxIt).m_liveboxId << ".icon.png";
+ targetFile << (**boxIt).m_liveboxId << "." << DEFAULT_ICON_NAME;
- DPL::FileInput input(sourceFile.str());
- DPL::FileOutput output(targetFile.str());
- DPL::Copy(&input, &output);
+ DynamicBoxFileCopy(sourceFile.str(), targetFile.str(), icon);
// clear stream objects
sourceFile.str("");
targetFile.str("");
}
-
m_context.job->UpdateProgress(
InstallerContext::INSTALL_COPY_LIVEBOX_FILES,
"Livebox files copy Finished");
}
+void TaskManifestFile::DynamicBoxFileCopy(const std::string& sourceFile,
+ const std::string& targetFile)
+{
+ Try
+ {
+ DPL::FileInput input(sourceFile);
+ DPL::FileOutput output(targetFile);
+ DPL::Copy(&input, &output);
+ }
+ Catch(DPL::Exception)
+ {
+ LogError("Copying Dynamic Box File Failed. " << sourceFile
+ << " to " << targetFile);
+ ReThrowMsg(Exceptions::DynamicBoxFailed, "Dynamic Box File Copy Failed.");
+ }
+}
+
void TaskManifestFile::stepBackupIconFiles()
{
LogDebug("Backup Icon Files");
DECLARE_JOB_EXCEPTION(Base, RemovingFileFailure, ErrorFatalError)
DECLARE_JOB_EXCEPTION(Base, CreateVconfFailure, ErrorFatalError)
DECLARE_JOB_EXCEPTION(Base, CopyIconFailed, ErrorFatalError)
+DECLARE_JOB_EXCEPTION(Base, DynamicBoxFailed, ErrorFatalError)
DECLARE_JOB_EXCEPTION(Base, FileOperationFailed, ErrorFatalError)
DECLARE_JOB_EXCEPTION(Base, InstallToExternalFailed, ErrorFatalError)
DECLARE_JOB_EXCEPTION(Base, BackupFailed, ErrorFatalError)