#include <string.h>
#include <appcore-efl.h>
#include <vconf.h>
+#include <errno.h>
+#include <sys/stat.h>
/* For multi-user support */
#include <tzplatform_config.h>
#include "bt-share-notification.h"
#include "bt-share-common.h"
#include "bt-share-cynara.h"
+#include "bt-share-db.h"
+
#include <sys/types.h>
#include <unistd.h>
}
}
+void __bt_create_transfer_db(void)
+{
+ struct stat sts;
+ int ret;
+
+ /* Check if the DB exists; if not, create it and initialize it */
+ ret = stat(BT_TRANSFER_DB, &sts);
+ if (ret == -1 && errno == ENOENT)
+ {
+ DBG("DB %s doesn't exist, it needs to be created and initialized", BT_TRANSFER_DB);
+ DBG("script path: %s", SCRIPT_INIT_DB);
+ ret = system(SCRIPT_INIT_DB);
+ if (ret != EXIT_SUCCESS)
+ ERR("Exit code of epp not clean: %i", ret);
+ }
+}
+
int main(void)
{
int ret;
signal(SIGTERM, __bt_sigterm_handler);
+ __bt_create_transfer_db();
+
if (__bt_dbus_request_name() == FALSE) {
DBG("Aleady dbus instance existed\n");
exit(0);
{
int ret;
sqlite3 *db = NULL;
- struct stat sts;
-
- /* Check if the DB exists; if not, create it and initialize it */
- ret = stat(BT_TRANSFER_DB, &sts);
- if (ret == -1 && errno == ENOENT)
- {
- DBG("DB %s doesn't exist, it needs to be created and initialized", BT_TRANSFER_DB);
- DBG("script path: %s", SCRIPT_INIT_DB);
- ret = system(SCRIPT_INIT_DB);
- if (ret != EXIT_SUCCESS)
- ERR("Exit code of epp not clean: %i", ret);
- }
ret = db_util_open(BT_TRANSFER_DB, &db, DB_UTIL_REGISTER_HOOK_METHOD);
if (ret) {
#define BT_OUTBOUND_TABLE "outbound"
#define BT_DB_QUERY_LEN 512
-#define SCRIPT_INIT_DB tzplatform_mkpath(TZ_USER_DATA, "bluetooth-share/init_db.sh")
+//#define SCRIPT_INIT_DB tzplatform_mkpath(TZ_USER_DATA, "bluetooth-share/init_db.sh")
+#define SCRIPT_INIT_DB "/opt/data/bluetooth-share/init_db.sh"
+
#define TABLE(type) ((type == BT_DB_INBOUND) ? BT_INBOUND_TABLE : BT_OUTBOUND_TABLE)
#define TEXT(s, n) (char *)sqlite3_column_text(s, n)
-%define TZ_SYS_SHARE /opt/home/owner/data/
+%define TZ_SYS_DATA /opt/data/
Name: bluetooth-share
Summary: Bluetooth file share Agent
%install
%make_install
-mkdir -p %{buildroot}%{TZ_SYS_SHARE}/bt-ftp
-install -D -m 0755 %{SOURCE1004} %{buildroot}%{TZ_SYS_SHARE}/%{name}/init_db.sh
-
-%post
-/sbin/ldconfig
-%{TZ_SYS_SHARE}/%{name}/init_db.sh
+install -D -m 0755 %{SOURCE1004} %{buildroot}%{TZ_SYS_DATA}/%{name}/init_db.sh
%post -n libbluetooth-share-devel -p /sbin/ldconfig
%defattr(-,root,root,-)
%{_bindir}/bluetooth-share
%{_datadir}/dbus-1/system-services/org.bluetooth.share.service
-%{TZ_SYS_SHARE}/bt-ftp
-%{TZ_SYS_SHARE}/%{name}
+%{TZ_SYS_DATA}/%{name}/init_db.sh
%files -n libbluetooth-share
%manifest libbluetooth-share.manifest