From: Mike Blumenkrantz Date: Wed, 29 May 2019 13:18:20 +0000 (-0400) Subject: elm: fix value of datadir when running in tree X-Git-Tag: accepted/tizen/unified/20190604.014647~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86b5df4ec857649b1441a628d2f23b69ffc9c529;p=platform%2Fupstream%2Fefl.git 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 --- 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; }