From f0e0a08562a88cac22640384e1f8cadbec9f4ce1 Mon Sep 17 00:00:00 2001 From: "Sabera Djelti (sdi2)" Date: Mon, 10 Feb 2014 14:26:55 +0100 Subject: [PATCH] Remove hardcoded path for multiuser support bug-tizen: PTREL-662 Change-Id: I66ab7ff37a89703576ea90885300364cc63f8bf6 Signed-off-by: Sabera Djelti (sdi2) --- CMakeLists.txt | 4 ++-- client/CMakeLists.txt | 2 +- client/ug-client.c | 6 +++++- packaging/ui-gadget-1.spec | 6 ++++-- src/module.c | 6 ++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7733cdf..c665300 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ SET(SRCS src/ug.c ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) -SET(PKGS_CHECK_MODULES "glib-2.0 bundle dlog capi-appfw-application appsvc capi-appfw-app-manager ecore") +SET(PKGS_CHECK_MODULES "glib-2.0 bundle dlog capi-appfw-application appsvc capi-appfw-app-manager ecore libtzplatform-config") IF (with_x) PKG_CHECK_MODULES(PKGS REQUIRED ${PKGS_CHECK_MODULES} utilX x11) ENDIF(with_x) @@ -54,7 +54,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget-module.h DESTINATION INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget-engine.h DESTINATION ${INCLUDE_INSTALL_DIR}/ug-1) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget.h DESTINATION ${INCLUDE_INSTALL_DIR}/ug-1) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/SLP_UI_Gadget_PG.h DESTINATION ${INCLUDE_INSTALL_DIR}/ug-1) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/ui-gadget-1.rule DESTINATION /opt/etc/smack/accesses.d) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/ui-gadget-1.rule DESTINATION ${TZ_SYS_ETC}/smack/accesses.d) ADD_SUBDIRECTORY(ug-efl-engine) ADD_SUBDIRECTORY(client) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 35f00af..875d87f 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,7 +1,7 @@ SET(CLIENT ug-client) SET(CLIENT_SRCS ug-client.c) SET(CLIENT_VENDOR samsung) -SET(CLIENT_DIR /usr/bin) +SET(CLIENT_DIR ${TZ_SYS_BIN}) SET(CLIENT_LOCALEDIR /usr/share/locale) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/client/ug-client.c b/client/ug-client.c index 46bd4e7..ecaf16b 100644 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -35,10 +35,14 @@ #include "ug-client.h" +#include + #ifdef LOG_TAG #undef LOG_TAG #endif +#define PATH_UG_LAUNCHER tzplatform_mkpath(TZ_SYS_BIN,"ug-launcher") + #define LOG_TAG "UI_GADGET_CLIENT" static void prt_usage(const char *cmd) @@ -439,7 +443,7 @@ int main(int argc, char *argv[]) cmdlen = strlen(argv[0]); if (strncmp(argv[0], "ug-launcher", cmdlen) == 0 - || strncmp(argv[0], "/usr/bin/ug-launcher", cmdlen) == 0) { + || strncmp(argv[0], PATH_UG_LAUNCHER , cmdlen) == 0) { while ((opt = getopt(argc, argv, "n:d:")) != -1) { switch (opt) { case 'n': diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec index c63d955..baa0a30 100644 --- a/packaging/ui-gadget-1.spec +++ b/packaging/ui-gadget-1.spec @@ -25,6 +25,7 @@ BuildRequires: pkgconfig(capi-system-runtime-info) BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: cmake BuildRequires: edje-bin +BuildRequires: pkgconfig(libtzplatform-config) %description UI gadget library (development headers) @@ -46,6 +47,7 @@ cp %{SOURCE1001} . %build %cmake . \ +-DTZ_SYS_ETC=%TZ_SYS_ETC \ %if %{with wayland} && !%{with x} -Dwith_wayland=TRUE %else @@ -60,7 +62,7 @@ rm -rf %{buildroot} %post /sbin/ldconfig -ln -sf /usr/bin/ug-client /usr/bin/ug-launcher +ln -sf %{TZ_SYS_BIN}/ug-client %{TZ_SYS_BIN}/ug-launcher %postun -p /sbin/ldconfig @@ -72,7 +74,7 @@ ln -sf /usr/bin/ug-client /usr/bin/ug-launcher /usr/share/edje/ug_effect.edj %{_bindir}/ug-client /usr/share/edje/ug-client/*.edj -/opt/etc/smack/accesses.d/ui-gadget-1.rule +%{TZ_SYS_ETC}/smack/accesses.d/ui-gadget-1.rule %files devel %manifest %{name}.manifest diff --git a/src/module.c b/src/module.c index bd2fedc..8307325 100644 --- a/src/module.c +++ b/src/module.c @@ -33,6 +33,8 @@ #include "ug-module.h" #include "ug-dbg.h" +#include + #define UG_MODULE_INIT_SYM "UG_MODULE_INIT" #define UG_MODULE_EXIT_SYM "UG_MODULE_EXIT" @@ -66,10 +68,10 @@ struct ug_module *ug_module_load(const char *name) do { if (pkg_name) { - snprintf(ug_file, PATH_MAX, "/usr/apps/%s/lib/libug-%s.so", pkg_name, name); + snprintf(ug_file, PATH_MAX, "%s/%s/lib/libug-%s.so", tzplatform_getenv(TZ_SYS_RO_APP), pkg_name, name); if (file_exist(ug_file)) break; - snprintf(ug_file, PATH_MAX, "/opt/apps/%s/lib/libug-%s.so", pkg_name, name); + snprintf(ug_file, PATH_MAX, "%s/%s/lib/libug-%s.so", tzplatform_getenv(TZ_SYS_RO_APP), pkg_name, name); if (file_exist(ug_file)) break; } -- 2.7.4