nikolavp / awesome-pomodoro

Pomodoro time widget for the awesome window manager framework
59 stars 16 forks source link

Error on master: module 'impl' not found #35

Open blueyed opened 6 years ago

blueyed commented 6 years ago

With 5c4db06ba2db5d730f4bc4d070958387ea4ef6e4 I am getting:

error while running function!
stack traceback:
        /home/user/.config/awesome/pomodoro/init.lua:7: in main chunk
        [C]: in function 'require'
        /home/user/.config/awesome/rc.lua:688: in main chunk
error: /home/user/.config/awesome/pomodoro/init.lua:7: module 'impl' not found:
        no field package.preload['impl']
        no file './impl.lua'
        no file '/usr/share/luajit-2.0.5/impl.lua'
        no file '…/lua/5.1/impl.lua'
        no file '…/lua/5.1/impl/init.lua'
        no file '/usr/share/lua/5.1/impl.lua'
        no file '/usr/share/lua/5.1/impl/init.lua'
        no file '/home/user/.config/awesome/impl.lua'
        no file '/home/user/.config/awesome/impl/init.lua'
        no file '/etc/xdg/awesome/impl.lua'
        no file '/etc/xdg/awesome/impl/init.lua'
        no file '/usr/share/awesome/lib/impl.lua'
        no file '/usr/share/awesome/lib/impl/init.lua'
        no file './impl.so'
        no file '/usr/local/lib/lua/5.1/impl.so'
        no file '/usr/lib/lua/5.1/impl.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/home/user/.config/awesome/impl.so'
        no file '/etc/xdg/awesome/impl.so'
        no file '/usr/share/awesome/lib/impl.so'

I am using just require("pomodoro"). require("pomodoro/init") might be a workaround (mentioned in #34), but that should not be necessary.

The following patch fixes it:

diff --git i/init.lua w/init.lua
index 021d2d2..f8b9089 100644
--- i/init.lua
+++ w/init.lua
@@ -2,8 +2,8 @@ local wibox     = require("wibox")
 local awful     = require("awful")
 local naughty   = require("naughty")
 local beautiful = require("beautiful")
-local module_path = (...):match ("(.+/)[^/]+$") or ""
-local createPomodoro  = require(module_path..'impl')
+local module_path = (...)
+local createPomodoro  = require(module_path..'.impl')
 local timer     = (type(timer) == 'table' and timer or require("gears.timer"))
 local awesome   = awesome

But it should probably handle the case where people are using /init (or .init ?!) at the end already.

blueyed commented 6 years ago

With the patch above it fails to load the images then though:

2018-07-01 14:50:11 E: awesome: Failed to load '/home/user/.config/awesome//images/gray.png': Failed to open file “/home/user/.config/awesome//images/gray.png”: No such file or directory
blueyed commented 6 years ago

What about

diff --git i/init.lua w/init.lua
index 021d2d2..55f9f84 100644
--- i/init.lua
+++ w/init.lua
@@ -2,8 +2,8 @@ local wibox     = require("wibox")
 local awful     = require("awful")
 local naughty   = require("naughty")
 local beautiful = require("beautiful")
-local module_path = (...):match ("(.+/)[^/]+$") or ""
-local createPomodoro  = require(module_path..'impl')
+local module_path = (...):match ("(.+/)[^/]+$") or "pomodoro"
+local createPomodoro  = require(module_path..'.impl')
 local timer     = (type(timer) == 'table' and timer or require("gears.timer"))
 local awesome   = awesome

/cc @Ram-Z