diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-01-29 21:55:26 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-01-29 22:35:49 +0100 |
commit | 7728ff5912aebe2b21a3c0ca0d8624ec97dabdb6 (patch) | |
tree | 44840a4584c0107a557891e7b4f77585299a8969 | |
parent | 112bc71a0c7d5a981d37eaa5062f8a93d7ccc067 (diff) | |
download | rockbox-7728ff5912aebe2b21a3c0ca0d8624ec97dabdb6.tar.gz rockbox-7728ff5912aebe2b21a3c0ca0d8624ec97dabdb6.zip |
Export runtime detected paths to lua scripts. Adapt stopwatch to not use
hardcoded path.
Change-Id: I5b843002d63a332b3fad02973d00b9863d283062
-rw-r--r-- | apps/plugins/lua/rocklib.c | 12 | ||||
-rw-r--r-- | apps/plugins/stopwatch.lua | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 809b269b47..6a6be388d1 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -699,7 +699,8 @@ static const luaL_Reg rocklib[] = | |||
699 | extern const luaL_Reg rocklib_aux[]; | 699 | extern const luaL_Reg rocklib_aux[]; |
700 | 700 | ||
701 | 701 | ||
702 | #define RB_CONSTANT(x) lua_pushinteger(L, x); lua_setfield(L, -2, #x); | 702 | #define RB_CONSTANT(x) lua_pushinteger(L, x); lua_setfield(L, -2, #x); |
703 | #define RB_STRING_CONSTANT(x) lua_pushstring(L, x); lua_setfield(L, -2, #x); | ||
703 | /* | 704 | /* |
704 | ** Open Rockbox library | 705 | ** Open Rockbox library |
705 | */ | 706 | */ |
@@ -727,6 +728,15 @@ LUALIB_API int luaopen_rock(lua_State *L) | |||
727 | RB_CONSTANT(SCREEN_REMOTE); | 728 | RB_CONSTANT(SCREEN_REMOTE); |
728 | #endif | 729 | #endif |
729 | 730 | ||
731 | /* some useful paths constants */ | ||
732 | RB_STRING_CONSTANT(ROCKBOX_DIR); | ||
733 | RB_STRING_CONSTANT(HOME_DIR); | ||
734 | RB_STRING_CONSTANT(PLUGIN_DIR); | ||
735 | RB_STRING_CONSTANT(PLUGIN_APPS_DATA_DIR); | ||
736 | RB_STRING_CONSTANT(PLUGIN_GAMES_DATA_DIR); | ||
737 | RB_STRING_CONSTANT(PLUGIN_DATA_DIR); | ||
738 | RB_STRING_CONSTANT(VIEWERS_DATA_DIR); | ||
739 | |||
730 | rli_init(L); | 740 | rli_init(L); |
731 | 741 | ||
732 | return 1; | 742 | return 1; |
diff --git a/apps/plugins/stopwatch.lua b/apps/plugins/stopwatch.lua index c8fac3c000..87773e32cb 100644 --- a/apps/plugins/stopwatch.lua +++ b/apps/plugins/stopwatch.lua | |||
@@ -25,7 +25,7 @@ | |||
25 | require "actions" | 25 | require "actions" |
26 | require "buttons" | 26 | require "buttons" |
27 | 27 | ||
28 | STOPWATCH_FILE = "/.rockbox/rocks/apps/stopwatch.dat" | 28 | STOPWATCH_FILE = rb.PLUGIN_APPS_DATA_DIR .. "/stopwatch.dat" |
29 | 29 | ||
30 | 30 | ||
31 | local LapsView = { | 31 | local LapsView = { |