Hi, this small patch makes it much easier for users to modify the standard
libs by causing awesome to search the XDG configuration directories before
the std lib locations, meaning users don't need write permission for
/usr/[local/]share/awesome/lib/ in order to make changes.

-Stephen
From bed1d3642da923e58d0cd85272bc3e0b92762dbc Mon Sep 17 00:00:00 2001
From: Stephen Sugden <[email protected]>
Date: Fri, 4 Sep 2009 12:53:38 -0700
Subject: [PATCH] Put homedir before /usr/share in lua search path

---
 luaa.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/luaa.c b/luaa.c
index f278cda..9c4c1d7 100644
--- a/luaa.c
+++ b/luaa.c
@@ -805,7 +805,7 @@ luaA_init(xdgHandle* xdg)
     globalconf.hooks.timer = LUA_REFNIL;
     globalconf.hooks.exit = LUA_REFNIL;
 
-    /* add Lua lib path (/usr/share/awesome/lib by default) */
+    /* add Lua search paths */
     lua_getglobal(L, "package");
     if (LUA_TTABLE != lua_type(L, 1))
     {
@@ -819,9 +819,6 @@ luaA_init(xdgHandle* xdg)
         lua_pop(L, 1);
         return;
     }
-    lua_pushliteral(L, ";" AWESOME_LUA_LIB_PATH "/?.lua");
-    lua_pushliteral(L, ";" AWESOME_LUA_LIB_PATH "/?/init.lua");
-    lua_concat(L, 3); /* concatenate with package.path */
 
     /* add XDG_CONFIG_DIR as include path */
     const char * const *xdgconfigdirs = xdgSearchableConfigDirectories(xdg);
@@ -840,6 +837,11 @@ luaA_init(xdgHandle* xdg)
 
         lua_concat(L, 3); /* concatenate with package.path */
     }
+
+    /* add Lua lib path (/usr/share/awesome/lib by default) */
+    lua_pushliteral(L, ";" AWESOME_LUA_LIB_PATH "/?.lua");
+    lua_pushliteral(L, ";" AWESOME_LUA_LIB_PATH "/?/init.lua");
+    lua_concat(L, 3); /* concatenate with package.path */
     lua_setfield(L, 1, "path"); /* package.path = "concatenated string" */
 }
 
-- 
1.6.4.2

Reply via email to