+void TaskDatabase::StepRegisterExternalFiles()
+{
+ WrtDB::ExternalLocationList externalLocationsUpdate = m_context.locations->listExternalLocations();
+ if (m_context.existingWidgetInfo.isExist) //update
+ {
+ WidgetDAO dao(m_context.locations->getPkgname());
+ WrtDB::ExternalLocationList externalLocationsDB = dao.getWidgetExternalLocations();
+ LogDebug("Removing external files:");
+ FOREACH(file, externalLocationsDB)
+ {
+ if(std::find(externalLocationsUpdate.begin(), externalLocationsUpdate.end(), *file) == externalLocationsUpdate.end())
+ {
+ if(WrtUtilFileExists(*file))
+ {
+ LogDebug(" -> " << *file);
+ remove(file->c_str());
+ }
+ else if(WrtUtilDirExists(*file))
+ {
+ LogDebug(" -> " << *file);
+ if(!WrtUtilRemove(*file)){
+ ThrowMsg(Exceptions::RemovingFolderFailure,
+ "Failed to remove external directory");
+ }
+ }
+ else
+ {
+ LogWarning(" -> " << *file << "(no such a path)");
+ }
+ }
+ }
+ }
+ LogDebug("Registering external files:");
+ FOREACH(file, externalLocationsUpdate)
+ {
+ LogDebug(" -> " << *file);
+ }
+
+ //set external lcoations to be registered
+ m_context.widgetConfig.externalLocations = externalLocationsUpdate;
+}
+