Add current package path to lua search path
ryzzn opened this issue · comments
plz add this snippet to awesompd.lua cause someone may be not put awesompd directory in the lua package path like me. thx!
local _,_,dirname=string.find(debug.getinfo(1, "S").source, [[^@(.*)/([^/]-)$]])
package.path = dirname .. "/?.lua;" .. package.path
I don't quite get what it does. Could you please explain? Also why not placing awesompd into .config/awesome folder?
That's because I use your awesompd as submodule of my project and I think it's better clone it to another place rather than instead of ~/.config/awesome directory, maybe as it's sub directory, so that awesompd is in sub of ~/.config/awesome directory.
And that two lines of lua code just add local awesompd directory to lua package search path. I see your code assume awesompd is at ~/.config/awesome directory or some other package of your project will not found such as 'utf8.lua' and others.
By now I add LUA_PATH environment variable to achieve this and I think perhaps it should more portable with the simple way.
Sorry if disturb you, ^_^.
No problem Sylvester! I just wanted to know about the usecase.
I'm glad you've put awesompd to some novel use. But since no other Awesome packages do things like this by themselves, I think it should be done on per uses basis.
Feel free to contact me in case you need any help;).