Remove hardcoded path for multiuser support 23/16623/1 accepted/tizen/generic accepted/tizen_mobile accepted/tizen/generic/20140226.073644 accepted/tizen/ivi/20140226.210053 accepted/tizen/mobile/20140227.072257 submit/tizen/20140226.000721
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Thu, 23 Jan 2014 10:08:08 +0000 (11:08 +0100)
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Wed, 19 Feb 2014 15:15:54 +0000 (16:15 +0100)
Bug-Tizen: PTREL-350

Change-Id: I27ed851572d43b392b0bd72a8f1fcb606a012ffa
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
CMakeLists.txt
include/conf.h
packaging/liblivebox-viewer.spec
src/client.c
src/util.c

index cd29c15..3dbe5bc 100644 (file)
@@ -26,6 +26,7 @@ pkg_check_modules(pkgs REQUIRED
        db-util
        livebox-service
        vconf
+       libtzplatform-config
 )
 
 FOREACH(flag ${pkgs_CFLAGS})
@@ -42,10 +43,6 @@ ADD_DEFINITIONS("-DNDEBUG")
 ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
 #ADD_DEFINITIONS("-DFLOG")
 ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"")
-ADD_DEFINITIONS("-DINFO_SOCKET=\"/opt/usr/share/live_magazine/.live.socket\"")
-ADD_DEFINITIONS("-DCLIENT_SOCKET=\"/opt/usr/share/live_magazine/.client.socket\"")
-ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/opt/usr/share/live_magazine/.slave.socket\"")
-ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/opt/usr/share/live_magazine/.service.socket\"")
 ADD_LIBRARY(${PROJECT_NAME} SHARED
        src/dlist.c
        src/livebox.c
index 83f2ff4..f7c7208 100644 (file)
@@ -18,6 +18,9 @@
  * \note
  * milli seconds
  */
+
+#include <tzplatform_config.h>
+
 #define MAX_LOG_FILE   3
 #define MAX_LOG_LINE   1000
 #define SLAVE_LOG_PATH "/tmp/.dbox.service/log/"
index 45998f7..9921a26 100644 (file)
@@ -18,6 +18,8 @@ BuildRequires: pkgconfig(sqlite3)
 BuildRequires: pkgconfig(db-util)
 BuildRequires: pkgconfig(livebox-service)
 BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires:      libtzplatform-config
 
 %description
 API for creating a new instance of the livebox and managing its life-cycle.
index f3f3df2..7979b69 100644 (file)
@@ -45,6 +45,9 @@
 #include "conf.h"
 #include "file_service.h"
 #include "dlist.h"
+#include <tzplatform_config.h>
+
+#define CLIENT_SOCKET tzplatform_mkpath(TZ_USER_SHARE,"live_magazine/.client.socket")
 
 int errno;
 
index 66431c6..beffe34 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <dlog.h>
 #include <livebox-errno.h> /* For error code */
+#include <tzplatform_config.h>
 
 #include "debug.h"
 #include "util.h"
@@ -109,8 +110,8 @@ static inline int check_native_livebox(const char *pkgname)
        int len;
        char *path;
 
-       len = strlen(pkgname) * 2;
-       len += strlen("/opt/usr/live/%s/libexec/liblive-%s.so");
+       /* get lenght of path */
+       len = snprintf(NULL, 0, "%s/%s/libexec/liblive-%s.so",tzplatform_getenv(TZ_USER_LIVE),pkgname, pkgname);
 
        path = malloc(len + 1);
        if (!path) {
@@ -118,7 +119,7 @@ static inline int check_native_livebox(const char *pkgname)
                return LB_STATUS_ERROR_MEMORY;
        }
 
-       snprintf(path, len, "/opt/usr/live/%s/libexec/liblive-%s.so", pkgname, pkgname);
+       snprintf(path, len, "%s/%s/libexec/liblive-%s.so",tzplatform_getenv(TZ_USER_LIVE),pkgname, pkgname);
        if (access(path, F_OK | R_OK) != 0) {
                ErrPrint("%s is not a valid package\n", pkgname);
                free(path);
@@ -134,8 +135,8 @@ static inline int check_web_livebox(const char *pkgname)
        int len;
        char *path;
 
-       len = strlen(pkgname) * 2;
-       len += strlen("/opt/usr/apps/%s/res/wgt/livebox/index.html");
+       /* get lenght of path*/
+       len = snprintf(NULL, 0, "%s/%s/res/wgt/livebox/index.html",tzplatform_getenv(TZ_USER_APP),pkgname);
 
        path = malloc(len + 1);
        if (!path) {
@@ -143,7 +144,7 @@ static inline int check_web_livebox(const char *pkgname)
                return LB_STATUS_ERROR_MEMORY;
        }
 
-       snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname);
+       snprintf(path, len, "%s/%s/res/wgt/livebox/index.html",tzplatform_getenv(TZ_USER_APP) ,pkgname);
        if (access(path, F_OK | R_OK) != 0) {
                ErrPrint("%s is not a valid package\n", pkgname);
                free(path);