diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-03-29 13:22:39 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2016-03-29 13:23:58 +0100 |
commit | 18c208c7f94a20133f6ded4678371fb82d40cbf8 (patch) | |
tree | a15889a5e4554332ea246b9071d62d364abebc36 | |
parent | 7ad6c34a2c426b602fdb57897006a77d5f3f5c2d (diff) |
elua: add several file/dir utils used by doc gen
This will be expanded into a proper util lib later.
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/lib/elua/elua.c | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 7683969087..30910d909e 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -4882,6 +4882,7 @@ EFL_PLATFORM_DEPEND([ELUA], [evil]) | |||
4882 | EFL_INTERNAL_DEPEND_PKG([ELUA], [eina]) | 4882 | EFL_INTERNAL_DEPEND_PKG([ELUA], [eina]) |
4883 | EFL_INTERNAL_DEPEND_PKG([ELUA], [eo]) | 4883 | EFL_INTERNAL_DEPEND_PKG([ELUA], [eo]) |
4884 | EFL_INTERNAL_DEPEND_PKG([ELUA], [ecore]) | 4884 | EFL_INTERNAL_DEPEND_PKG([ELUA], [ecore]) |
4885 | EFL_INTERNAL_DEPEND_PKG([ELUA], [ecore_file]) | ||
4885 | 4886 | ||
4886 | EFL_DEPEND_PKG([ELUA], [LUAJIT], [luajit >= 2.0.0]) | 4887 | EFL_DEPEND_PKG([ELUA], [LUAJIT], [luajit >= 2.0.0]) |
4887 | 4888 | ||
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c index 47bcd3fb76..765b275965 100644 --- a/src/lib/elua/elua.c +++ b/src/lib/elua/elua.c | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "elua_private.h" | 1 | #include "elua_private.h" |
2 | 2 | ||
3 | #include <Ecore_File.h> | ||
4 | |||
3 | static Eina_Prefix *_elua_pfx = NULL; | 5 | static Eina_Prefix *_elua_pfx = NULL; |
4 | 6 | ||
5 | static int _elua_init_counter = 0; | 7 | static int _elua_init_counter = 0; |
@@ -12,6 +14,8 @@ elua_init(void) | |||
12 | if (_elua_init_counter > 0) return ++_elua_init_counter; | 14 | if (_elua_init_counter > 0) return ++_elua_init_counter; |
13 | 15 | ||
14 | eina_init(); | 16 | eina_init(); |
17 | ecore_file_init(); | ||
18 | |||
15 | _elua_log_dom = eina_log_domain_register(dom, EINA_COLOR_LIGHTBLUE); | 19 | _elua_log_dom = eina_log_domain_register(dom, EINA_COLOR_LIGHTBLUE); |
16 | if (_elua_log_dom < 0) | 20 | if (_elua_log_dom < 0) |
17 | { | 21 | { |
@@ -57,6 +61,7 @@ elua_shutdown(void) | |||
57 | eina_log_domain_unregister(_elua_log_dom); | 61 | eina_log_domain_unregister(_elua_log_dom); |
58 | _elua_log_dom = -1; | 62 | _elua_log_dom = -1; |
59 | 63 | ||
64 | ecore_file_shutdown(); | ||
60 | eina_shutdown(); | 65 | eina_shutdown(); |
61 | return _elua_init_counter; | 66 | return _elua_init_counter; |
62 | } | 67 | } |
@@ -388,10 +393,34 @@ _elua_state_i18n_setup(const Elua_State *es) | |||
388 | int _elua_module_init(lua_State *L); | 393 | int _elua_module_init(lua_State *L); |
389 | int _elua_module_system_init(lua_State *L); | 394 | int _elua_module_system_init(lua_State *L); |
390 | 395 | ||
396 | static int | ||
397 | _elua_file_is_dir(lua_State *L) | ||
398 | { | ||
399 | lua_pushboolean(L, ecore_file_is_dir(luaL_checkstring(L, 1))); | ||
400 | return 1; | ||
401 | } | ||
402 | |||
403 | static int | ||
404 | _elua_file_exists(lua_State *L) | ||
405 | { | ||
406 | lua_pushboolean(L, ecore_file_exists(luaL_checkstring(L, 1))); | ||
407 | return 1; | ||
408 | } | ||
409 | |||
410 | static int | ||
411 | _elua_file_mkdir(lua_State *L) | ||
412 | { | ||
413 | lua_pushboolean(L, ecore_file_mkdir(luaL_checkstring(L, 1))); | ||
414 | return 1; | ||
415 | } | ||
416 | |||
391 | const luaL_reg _elua_cutillib[] = | 417 | const luaL_reg _elua_cutillib[] = |
392 | { | 418 | { |
393 | { "init_module", _elua_module_init }, | 419 | { "init_module", _elua_module_init }, |
394 | { "popenv" , _elua_io_popen }, | 420 | { "popenv" , _elua_io_popen }, |
421 | { "file_is_dir", _elua_file_is_dir }, | ||
422 | { "file_exists", _elua_file_exists }, | ||
423 | { "file_mkdir" , _elua_file_mkdir }, | ||
395 | { NULL , NULL } | 424 | { NULL , NULL } |
396 | }; | 425 | }; |
397 | 426 | ||