Modifying path for db files 26/42026/4 accepted/tizen/tv/20150623.005629 submit/tizen/20150622.134331
authorYoungsoo Choi <kenshin.choi@samsung.com>
Mon, 22 Jun 2015 07:45:15 +0000 (16:45 +0900)
committerJung Ick Guack <ji.guack@samsung.com>
Mon, 22 Jun 2015 13:34:12 +0000 (22:34 +0900)
Browser crashes due to the error below.
>> Error while starting transaction
>> UNHANDLED EXCEPTION attempt to write a readonly database

Platform only allows following path to access db files.
>> /home/{ACCOUNT}/.applications/dbspace/

This patch supports multi-user mode and fixes the crash.

However, this should be reverted later
once multi-user db is supported via browser-provider.

Change-Id: I2a2cf7d3956dbba37653b773b203706f866e96a9
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
CMakeLists.txt
core/Config/Config.cpp
core/Config/ConfigValues.h.in
packaging/org.tizen.browser.spec

index cde545190785257456c9707ddd0e612e0b3a0272..94aed0cef3b328fd1c69e5c307750ef788cdd8b3 100644 (file)
@@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 2.8)
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(BINDIR "${PREFIX}/bin")
 SET(RESDIR "${PREFIX}/res" CACHE STRING "The path of resources")
-SET(RESDBDIR "/opt${PREFIX}/res")
 SET(WEBKITDIR "/opt/usr/data/webkit" CACHE STRING "The path of web engine")
 SET(EDJE_DIR "${RESDIR}/edje/")
 SET(CERTS_DIR "${RESDIR}/certs/")
index 3e274ea349520d139bde7a56a606e2df5be15904..26657346a196d5bdcaa1d1e9e7821ee119a916f5 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "browser_config.h"
 #include "Config.h"
+#include <tzplatform_config.h>
 
 namespace tizen_browser
 {
@@ -24,13 +25,16 @@ namespace config
 
 void DefaultConfig::load(const std::string &)
 {
+    const char *db_path = NULL;
+    db_path = tzplatform_getenv(TZ_USER_DB);
+
     m_data["main_service_name"] = std::string("org.tizen.browser.base_UI");
     //m_data["favorite_service_name"] = std::string("org.tizen.browser.service.favorite.browserProvider");
     m_data["favorite_service_name"] = std::string("org.tizen.browser.favoriteservice");
-    m_data["DB_BOOKMARK"] = std::string("bookmark.db");
-    m_data["DB_SETTINGS"] = std::string("settings.db");
-    m_data["DB_HISTORY"] = std::string("history.db");
-    m_data["DB_SESSION"] = std::string("session.db");
+    m_data["DB_BOOKMARK"] = std::string(".browser.bookmark.db");
+    m_data["DB_SETTINGS"] = std::string(".browser.settings.db");
+    m_data["DB_HISTORY"] = std::string(".browser.history.db");
+    m_data["DB_SESSION"] = std::string(".browser.session.db");
 
     m_data["TOOLTIP_DELAY"] = 0.05; // time from mouse in to tooltip show
     m_data["TOOLTIP_HIDE_TIMEOUT"] = 2.0; // time from tooltip show to tooltip hide
@@ -39,7 +43,7 @@ void DefaultConfig::load(const std::string &)
 
 #   include "ConfigValues.h"
 
-
+    m_data["resourcedb/dir"] = std::string(db_path)+"/";
 }
 
 void DefaultConfig::store(const std::string & )
index ae280026525f3f61dcb1ab58f1169d39f93dc74e..53fce72cf56dbdaf2df4ca359e82434ad20514cb 100644 (file)
@@ -1,5 +1,4 @@
 //This is template file for configuration variables.
 m_data["services/dir"] = std::string("@CMAKE_INSTALL_PREFIX@/services");
 m_data["resource/dir"] = std::string("@RESDIR@");
-m_data["resourcedb/dir"] = std::string("@RESDBDIR@/db/");
 m_data["webkit/dir"] = std::string("@WEBKITDIR@");
index ffbba3b3d039c414ca3950a56777165eeb671e27..66ddef93516868f6d309c1cdd095d3b08ba21b73 100644 (file)
@@ -35,7 +35,8 @@ BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(capi-network-connection)
 BuildRequires:  pkgconfig(libpng)
 BuildRequires:  pkgconfig(libcurl)
-BuildRequires: browser-provider-devel
+BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  browser-provider-devel
 
 BuildRequires:  cmake
 BuildRequires:  edje-tools
@@ -56,7 +57,6 @@ BuildRequires:        pkgconfig(dlog)
 
 %define _appdir /usr/apps/%{name}
 %define _bindir %{_appdir}/bin
-%define _appdatadir /opt/usr/apps/%{name}
 %define COVERAGE_STATS %{?coverage_stats:ON}%{!?coverage_stats:OFF}
 
 %define _manifestdir /usr/share/packages
@@ -98,23 +98,11 @@ cd %{_build_dir}
 
 %post
 
-#Prepare files
-if [ ! -f %{_appdatadir}/res/db/bookmark.db ];
-then
-    mkdir -p %{_appdatadir}/res/db
-    chsmack -a "dtv-org.tizen.browser" %{_appdatadir}/res/db
-    sqlite3 %{_appdatadir}/res/db/bookmark.db ''
-    chsmack -a "dtv-org.tizen.browser" %{_appdatadir}/res/db/bookmark.db
-fi
-
 mkdir -p /opt/usr/data/webkit/storage
 mkdir -p /opt/usr/data/webkit/favicon
 
 #Change ownership and privileges
-chown -R 5000:5000 %{_appdatadir}/res/db
 chown -R 5000:5000 /opt/usr/data/webkit
-chmod -R 777 %{_appdatadir}/res/db
-chmod 777 %{_appdatadir}/res/db/bookmark.db
 chmod -R 660 /opt/usr/data/webkit
 
 %files