Skip to content

Commit

Permalink
Fix symlinked plugin directories not loading
Browse files Browse the repository at this point in the history
Due to a bug in LÖVE that goes down to PhysFS[1], a symlinked directory
isn't recognized as a directory, so symlinked plugin directories won't
be loaded.

To fix this, just load it anyway if it's a symlink. If the symlink turns
out to be a file, that's harmless because it will just be loaded as an
unknown plugin that does nothing.

[1]: love2d/love#1938
  • Loading branch information
InfoTeddy committed Jun 10, 2023
1 parent efd77cb commit 5a7b317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/love11compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ love.filesystem.isFile = function(filename)
return love.filesystem.getInfo(filename, "file") ~= nil
end

love.filesystem.isSymlink = function(filename)
return love.filesystem.getInfo(filename, "symlink") ~= nil
end

love.filesystem.getLastModified = function(filename)
local info = love.filesystem.getInfo(filename)
if info == nil then return nil end
Expand Down
4 changes: 3 additions & 1 deletion Source/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ function loadplugins()
folders = love.filesystem.getDirectoryItems("plugins")

for k,v in pairs(folders) do
if love.filesystem.isDirectory("plugins/" .. v) or v:sub(-4, -1) == ".zip" then
if love.filesystem.isDirectory("plugins/" .. v)
or (love_version_meets(9, 2) and love.filesystem.isSymlink("plugins/" .. v))
or v:sub(-4, -1) == ".zip" then
-- This is a plugin folder/zip, neat! But if it's a zip, then we first need to mount it.
local pluginpath, pluginname

Expand Down

0 comments on commit 5a7b317

Please sign in to comment.