* to package manager
*/
#include "package-manager-plugin.h"
+#include <regex.h>
#include <dlog.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <vcore/VCore.h>
static int pkg_plugin_app_is_installed(const char *pkg_name)
{
+ const char* REG_PKGID_PATTERN = "^[a-zA-Z0-9]{10}$";
LogDebug("pkg_plugin_app_is_installed() is called");
WrtDB::WrtDatabase::attachToThreadRO();
- bool result = WidgetDAOReadOnly::isWidgetInstalled(
- DPL::FromUTF8String(pkg_name));
+ regex_t reg;
+ if (regcomp(®, REG_PKGID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
+ LogDebug("Regcomp failed");
+ }
+
+ WrtDB::TizenAppId appid;
+
+ if ((regexec(®, pkg_name,
+ static_cast<size_t>(0), NULL, 0) == 0))
+ {
+ WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name));
+ appid = WidgetDAOReadOnly::getTzAppId(pkgid);
+ } else {
+ appid = DPL::FromUTF8String(pkg_name);
+ }
+
+ bool result = WidgetDAOReadOnly::isWidgetInstalled(appid);
WrtDB::WrtDatabase::detachFromThread();
if (result) {