Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tilde in userruntime variable used in package.path not expanded #3518

Closed
habibalamin opened this issue Aug 7, 2023 · 1 comment · Fixed by #3703
Closed

Tilde in userruntime variable used in package.path not expanded #3518

habibalamin opened this issue Aug 7, 2023 · 1 comment · Fixed by #3703

Comments

@habibalamin
Copy link
Contributor

Looks like a bunch of paths under ~/.local/share/hammerspoon/site are added to package.{c,}path in setup.lua. See the current tree:

local userruntime = "~/.local/share/hammerspoon/site"
local paths = {
configdir .. "/?.lua",
configdir .. "/?/init.lua",
configdir .. "/Spoons/?.spoon/init.lua",
package.path,
modpath .. "/?.lua",
modpath .. "/?/init.lua",
userruntime .. "/?.lua",
userruntime .. "/?/init.lua",
userruntime .. "/Spoons/?.spoon/init.lua",
}
local cpaths = {
configdir .. "/?.dylib",
configdir .. "/?.so",
package.cpath,
frameworkspath .. "/?.dylib",
userruntime .. "/lib/?.dylib",
userruntime .. "/lib/?.so",
}

Unfortunately, using a directory in the path doesn't work, unless you add the same path with /Users/$USER instead of ~. I think that first line which sets userruntime should be set to os.getenv("HOME") .. "/.local/share/hammerspoon/site" instead of ~/.local/share/hammerspoon/site.

cmsj pushed a commit that referenced this issue Nov 12, 2024
Lua doesn't automatically expand tildes to `$HOME`, as this code seems
to assume.

Fix #3518
@cmsj
Copy link
Member

cmsj commented Nov 12, 2024

Good catch, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants