#include <widget_install/job_widget_install.h>
#include <dpl/copy.h>
#include <dpl/file_output.h>
+#include "dpl/utils/path.h"
#include <dpl/abstract_waitable_input_adapter.h>
#include <dpl/wrt-dao-ro/global_config.h>
-#include <task_commons.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include <installer_log.h>
_D("Path to extract: %s", newPath.c_str());
// Create path in case of it is empty
- createTempPath(newPath);
+ Try
+ {
+ DPL::Utils::MakeDir(DPL::Utils::Path(newPath));
+ }
+ Catch(DPL::Utils::Path::BaseException)
+ {
+ ThrowMsg(Exceptions::FileOperationFailed, "Failed to create temporary directory");
+ }
} else {
// This is regular file
std::string fileExtractPath = destination + "/" + fileName;
_D("Path and file: %s : %s", pathAndFile.path.c_str(), pathAndFile.file.c_str());
// First, ensure that path exists
- createTempPath(pathAndFile.path);
+ Try
+ {
+ DPL::Utils::MakeDir(DPL::Utils::Path(pathAndFile.path));
+ }
+ Catch(DPL::Utils::Path::BaseException)
+ {
+ ThrowMsg(Exceptions::FileOperationFailed, "Failed to create temporary directory");
+ }
Try
{
return false;
}
+ // clear existing error
+ dlerror();
+
drm_oem_sapps_is_drm_file = reinterpret_cast <int (*)(const char*, int)>
(dlsym(pHandle, "drm_oem_sapps_is_drm_file"));
- pErrorMsg = dlerror();
- if ((pErrorMsg != NULL) || (drm_oem_sapps_is_drm_file == NULL)) {
- _E("dlopen failed : %s [%s]", source.c_str(), pErrorMsg);
+
+ if ((pErrorMsg = dlerror()) != NULL) {
+ _E("dlsym failed : %s [%s]", source.c_str(), pErrorMsg);
+ dlclose(pHandle);
+ return false;
+ }
+
+ if (drm_oem_sapps_is_drm_file == NULL) {
+ _E("drm_oem_sapps_is_drm_file is NULL : %s", source.c_str());
dlclose(pHandle);
return false;
}
return false;
}
+ // clear existing error
+ dlerror();
+
drm_oem_sapps_decrypt_package = reinterpret_cast <int (*)(const char*, int,
const char*, int)>
(dlsym(pHandle, "drm_oem_sapps_decrypt_package"));
- pErrorMsg = dlerror();
- if ((pErrorMsg != NULL) || (drm_oem_sapps_decrypt_package == NULL)) {
- _E("dlopen failed : %s [%s]", source.c_str(), pErrorMsg);
+
+ if ((pErrorMsg = dlerror()) != NULL) {
+ _E("dlsym failed : %s [%s]", source.c_str(), pErrorMsg);
+ dlclose(pHandle);
+ return false;
+ }
+
+ if (drm_oem_sapps_decrypt_package == NULL) {
+ _E("drm_oem_sapps_decrypt_package is NULL : %s", source.c_str());
dlclose(pHandle);
return false;
}