summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-02-21 10:06:02 +0100
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-02-22 09:26:55 +0100
commitc4f33c67a8d75888b21a0f464b0b1c82bd55bd0b (patch)
tree2835fab56c775b14bca1ff1b0af859542557f4c9
parent7165003bc60177818a491db0d6a557dd0767554b (diff)
downloadefl-c4f33c67a8d75888b21a0f464b0b1c82bd55bd0b.tar.gz
move from efl.vpath to eina_vpath
The usages from efl.vpath are moved to to eina_vpath
-rw-r--r--src/lib/ecore/ecore.c11
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_buffer.c10
-rw-r--r--src/lib/edje/edje_edit.c9
-rw-r--r--src/lib/edje/edje_load.c9
-rw-r--r--src/lib/efl/interfaces/efl_file.c14
-rw-r--r--src/lib/efreet/efreet.c71
-rw-r--r--src/lib/efreet/efreet_base.c8
-rw-r--r--src/lib/eina/eina_vpath.c1
-rw-r--r--src/lib/elementary/elm_config.c13
-rw-r--r--src/lib/elementary/elm_main.c17
-rw-r--r--src/lib/emotion/emotion_smart.c23
-rw-r--r--src/modules/ecore_buffer/shm/ecore_buffer_shm.c6
12 files changed, 95 insertions, 97 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index a7b4025109..d911bc4e23 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -122,8 +122,6 @@ static void _systemd_watchdog_cb(void *data, const Efl_Event *event);
static Efl_Loop_Timer *_systemd_watchdog = NULL;
#endif
-static Efl_Vpath *vpath = NULL;
-
Eina_Lock _ecore_main_loop_lock;
int _ecore_main_lock_count;
@@ -279,9 +277,6 @@ ecore_init(void)
_ecore_main_loop_init();
if (!_ecore_event_init()) goto shutdown_event;
- vpath = efl_add(EFL_VPATH_CORE_CLASS, NULL);
- if (vpath) efl_vpath_manager_register(EFL_VPATH_MANAGER_CLASS, 0, vpath);
-
_ecore_signal_init();
#ifndef HAVE_EXOTIC
_ecore_exe_init();
@@ -451,12 +446,6 @@ ecore_shutdown(void)
_ecore_main_shutdown();
_ecore_signal_shutdown();
- if (vpath)
- {
- efl_del(vpath);
- vpath = NULL;
- }
-
_ecore_main_loop_shutdown();
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLOC_INFO)
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c
index 50dca1b35a..a7cb174cb2 100644
--- a/src/lib/ecore_wl2/ecore_wl2_buffer.c
+++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c
@@ -310,15 +310,15 @@ err:
static Buffer_Handle *
_wl_shm_alloc(Buffer_Manager *self EINA_UNUSED, const char *name EINA_UNUSED, int w, int h, unsigned long *stride, int32_t *fd)
{
- Efl_Vpath_File *file_obj;
Eina_Tmpstr *fullname;
size_t size = w * h * 4;
void *out = NULL;
+ char *tmp;
+
+ tmp = eina_vpath_resolve("(:usr.run:)/evas-wayland_shm-XXXXXX");
+ *fd = eina_file_mkstemp(tmp, &fullname);
+ free(tmp);
- file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
- "(:run:)/evas-wayland_shm-XXXXXX");
- *fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname);
- efl_del(file_obj);
if (*fd < 0) return NULL;
unlink(fullname);
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 05336438d6..c908beba45 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -256,16 +256,11 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
* groups).
* P.S. don't forget about mmap version below
*/
- Efl_Vpath_File *file_obj =
- efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
- efl_vpath_file_do(file_obj);
- // XXX:FIXME: allow this to be async
- efl_vpath_file_wait(file_obj);
- file = efl_vpath_file_result_get(file_obj);
+ file = eina_vpath_resolve(file);
Eina_Bool int_ret;
int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group);
- efl_del(file_obj);
+
if (!int_ret)
return EINA_FALSE;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index a458b77970..6c749bcdb6 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -262,18 +262,13 @@ edje_file_collection_list(const char *file)
Eina_List *lst;
if ((!file) || (!*file)) return NULL;
- Efl_Vpath_File *file_obj =
- efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
- efl_vpath_file_do(file_obj);
- // XXX:FIXME: allow this to be async
- efl_vpath_file_wait(file_obj);
- file = efl_vpath_file_result_get(file_obj);
+ file = eina_vpath_resolve(file);
f = eina_file_open(file, EINA_FALSE);
lst = edje_mmap_collection_list(f);
eina_file_close(f);
- efl_del(file_obj);
+ free(file);
return lst;
}
diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c
index 562a06b059..65060d858d 100644
--- a/src/lib/efl/interfaces/efl_file.c
+++ b/src/lib/efl/interfaces/efl_file.c
@@ -7,8 +7,6 @@
typedef struct _Efl_File_Data Efl_File_Data;
struct _Efl_File_Data
{
- Eo *vo;
-
Efl_Image_Load_Error error;
};
@@ -22,11 +20,7 @@ _efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file, const char *key
if (file)
{
- pd->vo = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
- efl_vpath_file_do(pd->vo);
- // XXX:FIXME: allow this to be async
- efl_vpath_file_wait(pd->vo);
- file = efl_vpath_file_result_get(pd->vo);
+ file = eina_vpath_resolve(file);
}
if (file)
@@ -41,12 +35,8 @@ _efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file, const char *key
if (f) eina_file_close(f);
on_error:
- if (pd->vo && (!efl_vpath_file_keep_get(pd->vo)))
- {
- efl_del(pd->vo);
- pd->vo = NULL;
- }
+ free(file);
return r;
}
diff --git a/src/lib/efreet/efreet.c b/src/lib/efreet/efreet.c
index 091899f2b2..1acbdbd8d7 100644
--- a/src/lib/efreet/efreet.c
+++ b/src/lib/efreet/efreet.c
@@ -36,6 +36,74 @@ static uid_t ruid;
static uid_t rgid;
#endif
+static void
+_efreet_efreet_app_interface_set(void)
+{
+ char buf[PATH_MAX];
+ char *s;
+ const char *home;
+ Eina_Vpath_Interface_User user;
+
+ home = eina_vpath_resolve("(:home:)/");
+
+ memset(&user, 0, sizeof(Eina_Vpath_Interface_User));
+
+# if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
+# define ENV_HOME_SET(_env, _dir, _meta) \
+ if ((getuid() != geteuid()) || (!(s = getenv(_env)))) { \
+ snprintf(buf, sizeof(buf), "%s/"_dir, home); \
+ s = buf; \
+ } \
+ (&user)->_meta = s;
+#else
+# define ENV_HOME_SET(_env, _dir, _meta) \
+ if (!(s = getenv(_env))) { \
+ snprintf(buf, sizeof(buf), "%s/"_dir, home); \
+ s = buf; \
+ } \
+ (&user)->_meta = s;
+#endif
+ // $XDG_DESKTOP_DIR="$HOME/Desktop"
+ ENV_HOME_SET("XDG_DESKTOP_DIR", "Desktop", desktop);
+ // $XDG_DOCUMENTS_DIR="$HOME/Documents"
+ ENV_HOME_SET("XDG_DOCUMENTS_DIR", "Documents", documents);
+ // $XDG_DOWNLOAD_DIR="$HOME/Downloads"
+ ENV_HOME_SET("XDG_DOWNLOAD_DIR", "Downloads", downloads);
+ // $XDG_MUSIC_DIR="$HOME/Music"
+ ENV_HOME_SET("XDG_MUSIC_DIR", "Music", music);
+ // $XDG_PICTURES_DIR="$HOME/Pictures"
+ ENV_HOME_SET("XDG_PICTURES_DIR", "Pictures", pictures);
+ // $XDG_PUBLICSHARE_DIR="$HOME/Public"
+ ENV_HOME_SET("XDG_PUBLIC_DIR", "Public", pub);
+ // $XDG_TEMPLATES_DIR="$HOME/.Templates"
+ ENV_HOME_SET("XDG_TEMPLATES_DIR", ".Templates", templates);
+ // $XDG_VIDEOS_DIR="$HOME/Videos"
+ ENV_HOME_SET("XDG_VIDEOS_DIR", "Videos", videos);
+ // $XDG_DATA_HOME defines the base directory relative to which user
+ // specific data files should be stored. If $XDG_DATA_HOME is either
+ // not set or empty, a default equal to $HOME/.local/share should be
+ // used.
+ ENV_HOME_SET("XDG_DATA_HOME", ".local/share", data);
+ // $XDG_CONFIG_HOME defines the base directory relative to which user
+ // specific configuration files should be stored. If $XDG_CONFIG_HOME
+ // is either not set or empty, a default equal to $HOME/.config should
+ // be used.
+ ENV_HOME_SET("XDG_CONFIG_HOME", ".config", config);
+ // $XDG_CACHE_HOME defines the base directory relative to which
+ // user specific non-essential data files should be stored. If
+ // $XDG_CACHE_HOME is either not set or empty, a default equal to
+ // $HOME/.cache should be used.
+ ENV_HOME_SET("XDG_CACHE_HOME", ".cache", cache);
+
+ if ((getuid() != geteuid()) || (!(s = getenv("XDG_RUNTIME_DIR"))))
+ user.run = NULL;
+ else
+ user.run = s;
+
+ eina_vpath_interface_user_set(&user);
+}
+
+
EAPI int
efreet_init(void)
{
@@ -70,6 +138,9 @@ efreet_init(void)
if (!ecore_file_init())
goto shutdown_ecore;
+ //this needs to be early initializied efreet itself is using vpaths
+ _efreet_efreet_app_interface_set();
+
if (!efreet_base_init())
goto shutdown_ecore_file;
diff --git a/src/lib/efreet/efreet_base.c b/src/lib/efreet/efreet_base.c
index 63810318f8..8b35285148 100644
--- a/src/lib/efreet/efreet_base.c
+++ b/src/lib/efreet/efreet_base.c
@@ -279,7 +279,6 @@ efreet_dirs_reset(void)
static void
efreet_dirs_init(void)
{
- Efl_Vpath_File *file_obj;
char buf[PATH_MAX];
/* efreet_home_dir */
@@ -309,10 +308,9 @@ efreet_dirs_init(void)
#endif
/* xdg_runtime_dir */
- file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
- "(:run:)/");
- xdg_runtime_dir = eina_stringshare_add(efl_vpath_file_result_get(file_obj));
- efl_del(file_obj);
+ char *tmp = eina_vpath_resolve("(:usr.run:)/");
+ xdg_runtime_dir = eina_stringshare_add(tmp);
+ free(tmp);
/* hostname */
if (gethostname(buf, sizeof(buf)) < 0)
diff --git a/src/lib/eina/eina_vpath.c b/src/lib/eina/eina_vpath.c
index af57afae97..e744265955 100644
--- a/src/lib/eina/eina_vpath.c
+++ b/src/lib/eina/eina_vpath.c
@@ -318,7 +318,6 @@ eina_vpath_interface_app_set(const char *app_domain, Eina_Prefix *app_pfx)
EAPI void
eina_vpath_interface_user_set(Eina_Vpath_Interface_User *user)
{
- char buf[PATH_MAX];
Eina_Bool free_run = EINA_FALSE;
EINA_SAFETY_ON_NULL_RETURN(user);
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index 9401f8b77d..568dfd2c6a 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -615,7 +615,7 @@ _elm_config_user_dir_snprintf(char *dst,
{
size_t user_dir_len = 0, off = 0;
va_list ap;
- Efl_Vpath_File *file_obj;
+ char *tmp;
static int use_xdg_config = -1;
if (use_xdg_config == -1)
@@ -624,13 +624,12 @@ _elm_config_user_dir_snprintf(char *dst,
else use_xdg_config = 0;
}
if (use_xdg_config)
- file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
- "(:config:)/elementary");
+ tmp = eina_vpath_resolve("(:usr.config:)/elementary");
else
- file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
- "(:home:)/"ELEMENTARY_BASE_DIR);
- eina_strlcpy(dst, efl_vpath_file_result_get(file_obj), size);
- efl_del(file_obj);
+ tmp = eina_vpath_resolve("(:home:)/elementary" ELEMENTARY_BASE_DIR);
+
+ eina_strlcpy(dst, tmp, size);
+ free(tmp);
user_dir_len = strlen(dst);
off = user_dir_len + 1;
diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c
index 2c3777617d..007e886c7f 100644
--- a/src/lib/elementary/elm_main.c
+++ b/src/lib/elementary/elm_main.c
@@ -168,7 +168,6 @@ _prefix_check(void)
const char *dirs[4] = { NULL, NULL, NULL, NULL };
char *caps = NULL, *p1, *p2;
char buf[PATH_MAX];
- Efl_Vpath_Core *vpath;
if (app_pfx) return;
if (!app_domain) return;
@@ -200,21 +199,7 @@ _prefix_check(void)
app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain,
app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]);
- vpath = efl_vpath_core_get(EFL_VPATH_CORE_CLASS);
- efl_vpath_core_meta_set(vpath, "app.dir", eina_prefix_get(app_pfx));
- efl_vpath_core_meta_set(vpath, "app.bin", eina_prefix_bin_get(app_pfx));
- efl_vpath_core_meta_set(vpath, "app.lib", eina_prefix_lib_get(app_pfx));
- efl_vpath_core_meta_set(vpath, "app.data", eina_prefix_data_get(app_pfx));
- efl_vpath_core_meta_set(vpath, "app.locale", eina_prefix_locale_get(app_pfx));
- snprintf(buf, sizeof(buf), "%s/%s",
- efl_vpath_core_meta_get(vpath, "config"), app_domain);
- efl_vpath_core_meta_set(vpath, "app.config", buf);
- snprintf(buf, sizeof(buf), "%s/%s",
- efl_vpath_core_meta_get(vpath, "cache"), app_domain);
- efl_vpath_core_meta_set(vpath, "app.cache", buf);
- snprintf(buf, sizeof(buf), "%s/%s",
- efl_vpath_core_meta_get(vpath, "data"), app_domain);
- efl_vpath_core_meta_set(vpath, "app.local", buf);
+ eina_vpath_interface_app_set(app_domain, app_pfx);
}
static void
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index abcdc826f9..7e33a90a67 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -69,7 +69,6 @@ struct _Efl_Canvas_Video_Data
Ecore_Job *job;
- Efl_Vpath_File *file_obj;
Emotion_Xattr_Data *xattr;
const char *title;
@@ -372,35 +371,17 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *
_emotion_image_data_zero(sd->obj);
sd->open = 0;
- if (sd->file_obj)
- {
- efl_del(sd->file_obj);
- sd->file_obj = NULL;
- }
if (file)
{
- sd->file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, file);
- efl_vpath_file_do(sd->file_obj);
- // XXX:FIXME: allow this to be async
- efl_vpath_file_wait(sd->file_obj);
- file2 = efl_vpath_file_result_get(sd->file_obj);
+ file2 = eina_vpath_resolve(file);
}
if (!emotion_engine_instance_file_open(sd->engine_instance, file2))
{
WRN("Couldn't open file=%s", sd->file);
- if (sd->file_obj)
- {
- efl_del(sd->file_obj);
- sd->file_obj = NULL;
- }
return EINA_FALSE;
}
- if ((sd->file_obj) && (!efl_vpath_file_keep_get(sd->file_obj)))
- {
- efl_del(sd->file_obj);
- sd->file_obj = NULL;
- }
+ free(file2);
DBG("successfully opened file=%s", sd->file);
sd->pos = 0.0;
if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0);
diff --git a/src/modules/ecore_buffer/shm/ecore_buffer_shm.c b/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
index 298225a634..2d65a20201 100644
--- a/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
+++ b/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
@@ -55,7 +55,6 @@ _ecore_buffer_shm_buffer_alloc(Ecore_Buffer_Module_Data bmdata, int width, int h
Ecore_Buffer_Shm_Data* b;
char *name;
int fd, page_size;
- Efl_Vpath_File *file_obj;
page_size = eina_cpu_page_size();
@@ -68,10 +67,7 @@ _ecore_buffer_shm_buffer_alloc(Ecore_Buffer_Module_Data bmdata, int width, int h
b->size = page_size * (((b->stride * b->h) + (page_size - 1)) / page_size);
b->am_owner = EINA_TRUE;
- file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
- "(:run:)/ecore-buffer-shared-XXXXXX");
- name = strdup(efl_vpath_file_result_get(file_obj));
- efl_del(file_obj);
+ name = eina_vpath_resolve("(:usr.run:)/ecore-buffer-shared-XXXXXX");
if (!name) goto err;
fd = mkostemp(name, O_CLOEXEC);