using namespace WrtDB;
namespace {
-const char* const NPRUNTIME_PLUGINS_DIR = "plugins/";
-
struct PathAndFilePair
{
std::string path;
position),
filePath.substr(position + 1));
}
-
-inline bool isNPPlugin(const std::string& filePath)
-{
- std::string::size_type pos = filePath.find(NPRUNTIME_PLUGINS_DIR);
- // Not specified if a plug-in name MUST end with a specific extension
- // (e.g. .so)
- return ((std::string::npos != pos) &&
- ('/' != filePath[filePath.length() - 1]));
-}
-
-// precondition: isNPPlugin(filePath) == true
-inline bool isValidNPPlugin(const std::string& filePath)
-{
- return (filePath.find(GlobalConfig::GetNPRuntimePluginsPath()) == 0);
-}
-
-bool shouldBeInstalled(const std::string& filePath)
-{
- if (isNPPlugin(filePath))
- {
- if (!isValidNPPlugin(filePath))
- {
- LogDebug("Not a valid NPRuntime plug-in: " << filePath);
- return false;
- }
- }
- return true;
-}
}
namespace Jobs {
// Extract file or path
std::string fileName = m_zipIterator->name;
- if (shouldBeInstalled(m_zipIterator->name))
- {
- if (fileName[fileName.size() - 1] == '/') {
- // This is path
- std::string newPath = destination + "/" +
- fileName.substr(0, fileName.size() - 1);
- LogPedantic("Path to extract: " << newPath);
-
- // Create path in case of it is empty
- createTempPath(newPath);
- } else {
- // This is regular file
- std::string fileExtractPath = destination + "/" + fileName;
-
- LogPedantic("File to extract: " << fileExtractPath);
-
- // Split into pat & file pair
- PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath);
-
- LogPedantic("Path and file: " <<
- pathAndFile.path <<
- " : " << pathAndFile.file);
-
- // First, ensure that path exists
- createTempPath(pathAndFile.path);
-
- Try
- {
- // Open file
- std::unique_ptr<DPL::ZipInput::File> file(
- m_zip->OpenFile(fileName));
-
- // Extract single file
- ExtractFile(file.get(), fileExtractPath);
- }
- Catch(DPL::ZipInput::Exception::OpenFileFailed)
- {
- ThrowMsg(Exceptions::ExtractFileFailed, fileName);
- }
+ if (fileName[fileName.size() - 1] == '/') {
+ // This is path
+ std::string newPath = destination + "/" +
+ fileName.substr(0, fileName.size() - 1);
+ LogPedantic("Path to extract: " << newPath);
+
+ // Create path in case of it is empty
+ createTempPath(newPath);
+ } else {
+ // This is regular file
+ std::string fileExtractPath = destination + "/" + fileName;
+
+ LogPedantic("File to extract: " << fileExtractPath);
+
+ // Split into pat & file pair
+ PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath);
+
+ LogPedantic("Path and file: " <<
+ pathAndFile.path <<
+ " : " << pathAndFile.file);
+
+ // First, ensure that path exists
+ createTempPath(pathAndFile.path);
+
+ Try
+ {
+ // Open file
+ std::unique_ptr<DPL::ZipInput::File> file(
+ m_zip->OpenFile(fileName));
+
+ // Extract single file
+ ExtractFile(file.get(), fileExtractPath);
+ }
+ Catch(DPL::ZipInput::Exception::OpenFileFailed)
+ {
+ ThrowMsg(Exceptions::ExtractFileFailed, fileName);
}
- }
- else
- {
- LogDebug("Skipping file: " << m_zipIterator->name);
}
// Check whether there are more files to extract
{
LogInfo("StepRemoveInstallationDirectory started");
Try {
- if (APP2EXT_SD_CARD !=
- app2ext_get_app_location(m_context.tzPkgid.c_str()))
- {
+ int ret = app2ext_get_app_location(m_context.tzPkgid.c_str());
+
+ if (APP2EXT_INTERNAL_MEM == ret) {
LogDebug("Removing directory");
m_context.removeStarted = true;
DPL::Utils::Path widgetDir= m_context.installedPath;
} Catch(DPL::Utils::Path::BaseException){
LogWarning(dataDir.Fullpath() << " is already removed");
}
- } else {
+ } else if (APP2EXT_SD_CARD == ret) {
LogDebug("Removing sdcard directory");
Try {
WidgetInstallToExtSingleton::Instance().initialize(m_context.tzPkgid);
Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
RemoveFilesFailed);
}
+ } else {
+ LogError("app is not installed");
+ ThrowMsg(Exceptions::WidgetNotExist, "failed to get app location");
}
} Catch(Exception::RemoveFilesFailed) {
ThrowMsg(Exceptions::RemoveFileFailure, "Cann't remove directory");
-
}
m_context.job->UpdateProgress(
UninstallerContext::UNINSTALL_REMOVE_WIDGETDIR,