row.Set_install_time(regInfo.installedTime);
row.Set_splash_img_src(regInfo.configInfo.splashImgSrc);
row.Set_background_page(regInfo.configInfo.backgroundPage);
-
+ row.Set_installed_path(regInfo.widgetInstalledPath);
DO_INSERT(row, WidgetExtendedInfo)
}
DPL::String WidgetDAOReadOnly::getPath() const
{
- DPL::String path = DPL::FromUTF8String(
- GlobalConfig::GetUserInstalledWidgetPath());
+ DPL::String path = *getWidgetInstalledPath();
DPL::String srcPath = DPL::FromUTF8String(GlobalConfig::GetWidgetSrcPath());
- DPL::OStringStream strAppId;
- strAppId << m_widgetHandle;
- DPL::OptionalString pkgname = getPkgname();
- path += L"/" + *pkgname;
path += srcPath + L"/";
return path;
return static_cast<SettingsType>(*result);
}
+DPL::OptionalString WidgetDAOReadOnly::getWidgetInstalledPath() const
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ using namespace DPL::DB::ORM;
+ using namespace DPL::DB::ORM::wrt;
+ WRT_DB_SELECT(select, WidgetExtendedInfo, &WrtDatabase::interface())
+ select->Where(Equals<WidgetExtendedInfo::app_id>(m_widgetHandle));
+
+ WidgetExtendedInfo::Select::RowList rows = select->GetRowList();
+ if (rows.empty()) {
+ ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
+ "Cannot find widget. Handle: " << m_widgetHandle);
+ }
+
+ return rows.front().Get_installed_path();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get widdget installed path")
+}
#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
#undef SQL_CONNECTION_EXCEPTION_HANDLER_END
#undef CHECK_WIDGET_EXISTENCE
}
/**
+ * WRT widgets that are preloaded
+ */
+inline const char* GetUserPreloadedWidgetPath()
+{
+ return "/usr/apps";
+}
+
+/**
+ * WRT widgets that are downloaded and installed by user
+ */
+inline const char* GetWidgetUserDataPath()
+{
+ return "/opt/usr/apps";
+}
+
+/**
* WRT widgets that are downloaded and installed by user
*/
inline const char* GetWidgetSrcPath()
inline std::string GetWidgetBasePath(DPL::String pkgName)
{
return PathBuilder()
- .Append(GlobalConfig::GetUserInstalledWidgetPath())
+ .Append(GlobalConfig::GetWidgetUserDataPath())
.Append(DPL::ToUTF8String(pkgName))
.GetFullPath();
}
PackagingType packagingType;
EncryptedFileList encryptedFiles;
ExternalLocationList externalLocations;
+ DPL::OptionalString widgetInstalledPath;
};
typedef std::list<std::string> CertificateChainList;
SettingsType getWebNotificationUsage() const;
SettingsType getWebDatabaseUsage() const;
SettingsType getFileSystemUsage() const;
+
+ /**
+ * This method returns widget's installed path
+ *
+ * @return path of widget installed
+ */
+ DPL::OptionalString getWidgetInstalledPath() const;
};
} // namespace WrtDB
COLUMN_NOT_NULL(test_widget, INT, CHECK(test_widget between 0 and 1) DEFAULT 0)
COLUMN(splash_img_src, VARCHAR(256), DEFAULT '')
COLUMN(background_page, VARCHAR(256), DEFAULT '')
+ COLUMN(installed_path, VARCHAR(512), DEFAULT '')
TABLE_CONSTRAINTS(
FOREIGN KEY(app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE
)