summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-03-29 13:22:39 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-03-29 13:23:58 +0100
commit18c208c7f94a20133f6ded4678371fb82d40cbf8 (patch)
treea15889a5e4554332ea246b9071d62d364abebc36 /src/lib/elua
parent7ad6c34a2c426b602fdb57897006a77d5f3f5c2d (diff)
elua: add several file/dir utils used by doc gen
This will be expanded into a proper util lib later.
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/elua.c29
1 files changed, 29 insertions, 0 deletions
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
3static Eina_Prefix *_elua_pfx = NULL; 5static Eina_Prefix *_elua_pfx = NULL;
4 6
5static int _elua_init_counter = 0; 7static 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)
388int _elua_module_init(lua_State *L); 393int _elua_module_init(lua_State *L);
389int _elua_module_system_init(lua_State *L); 394int _elua_module_system_init(lua_State *L);
390 395
396static 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
403static 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
410static 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
391const luaL_reg _elua_cutillib[] = 417const 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