From 86b5df4ec857649b1441a628d2f23b69ffc9c529 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 29 May 2019 09:18:20 -0400 Subject: [PATCH] elm: fix value of datadir when running in tree Summary: this makes it possible to successfully run elm_test out of the tree without installing @fix Depends on D8965 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8966 --- src/lib/elementary/elm_main.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 49ce3b4..818bd33 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -616,7 +616,22 @@ elm_app_data_dir_get(void) if (app_data_dir) return app_data_dir; _prefix_check(); if (!app_pfx) return ""; - app_data_dir = eina_prefix_data_get(app_pfx); + /* only used to run inside efl src tree */ + if (getenv("EFL_RUN_IN_TREE")) + { + /* "/some/path/to/repo/build/src" */ + const char *path = elm_app_prefix_dir_get(); + /* "/some/path/to/repo/build/" */ + const char *last_sep = strrchr(path, '/'); + Eina_Strbuf *buf = eina_strbuf_new(); + eina_strbuf_append_length(buf, path, last_sep - path + 1); + eina_strbuf_append(buf, "data/elementary"); + app_data_dir = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + /* yes this leaks app_data_dir but it's a one time allocation who cares */ + } + else + app_data_dir = eina_prefix_data_get(app_pfx); return app_data_dir; } -- 2.7.4