Fix WGT handlers includes
[platform/core/appfw/wgt-backend.git] / src / wgt / wgt_app_query_interface.cc
index 3f42f71..2798080 100644 (file)
 #include <boost/system/error_code.hpp>
 
 #include <common/pkgmgr_registration.h>
+#include <common/recovery_file.h>
 #include <common/request.h>
 #include <common/utils/file_util.h>
 
-#include <manifest_handlers/application_manifest_constants.h>
-#include <manifest_handlers/tizen_application_handler.h>
-#include <manifest_handlers/widget_handler.h>
 #include <manifest_parser/manifest_parser.h>
 #include <manifest_parser/utils/logging.h>
+#include <wgt_manifest_handlers/application_manifest_constants.h>
+#include <wgt_manifest_handlers/tizen_application_handler.h>
+#include <wgt_manifest_handlers/widget_handler.h>
 
 #include <memory>
 #include <string>
@@ -88,6 +89,13 @@ std::string GetPkgIdFromPath(const std::string& path) {
   return pkg_id;
 }
 
+std::string ReadPkgidFromRecovery(const std::string& recovery_path) {
+  std::unique_ptr<ci::recovery::RecoveryFile> recovery_file =
+      ci::recovery::RecoveryFile::OpenRecoveryFileForPath(recovery_path);
+  recovery_file->Detach();
+  return recovery_file->pkgid();
+}
+
 }  // namespace
 
 namespace wgt {
@@ -104,10 +112,12 @@ bool WgtAppQueryInterface::IsAppInstalledByArgv(int argc, char** argv) {
 
 bool WgtAppQueryInterface::IsHybridApplication(int argc, char** argv) {
   std::string arg = GetInstallationRequestInfo(argc, argv);
+  if (arg.find("apps_rw/recovery-") != std::string::npos)
+    arg = ReadPkgidFromRecovery(arg);
   if (ci::IsPackageInstalled(arg, ci::GetRequestMode())) {
     bf::path package_directory(ci::GetRootAppPath());
-    if (bf::exists(package_directory / kTizenManifestLocation) &&
-        bf::exists(package_directory / kHybridConfigLocation))
+    if (bf::exists(package_directory / arg / kTizenManifestLocation) &&
+        bf::exists(package_directory / arg / kHybridConfigLocation))
       return true;
   } else {
     bool tizen_manifest_found = false;