From fc19e5867876ecd994ddb00d1b5da37d24db9a3b Mon Sep 17 00:00:00 2001 From: Jake Eaker Date: Fri, 31 Jul 2026 13:47:53 -0400 Subject: [PATCH] added symlink support for mods --- conf.lua | 5 +++++ src/mods/LauncherMods.lua | 4 +++- src/mods/Loader.lua | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/conf.lua b/conf.lua index cf02b9d7..e96a18a7 100644 --- a/conf.lua +++ b/conf.lua @@ -1,4 +1,9 @@ function love.conf(t) + -- PhysFS ignores symlinks unless told otherwise, so a mod dev-linked into + -- mods/ (ln -s, matching the mklink /J workflow on Windows) is invisible + -- to love.filesystem.getDirectoryItems without this. + love.filesystem.setSymlinksEnabled(true) + local editor = os.getenv("POKEPORT_EDITOR") == "1" local developer = os.getenv("POKEPORT_DEV") == "1" if arg then diff --git a/src/mods/LauncherMods.lua b/src/mods/LauncherMods.lua index 62f37497..3a7e9062 100644 --- a/src/mods/LauncherMods.lua +++ b/src/mods/LauncherMods.lua @@ -223,7 +223,9 @@ local function discover() for _, name in ipairs(fs.getDirectoryItems("mods")) do local path = "mods/" .. name local info = fs.getInfo(path) - if info and info.type == "directory" then + -- a dev-linked mod dir (ln -s) reports type "symlink" even with + -- setSymlinksEnabled(true); see the matching note in Loader:_discover. + if info and (info.type == "directory" or info.type == "symlink") then local raw = fs.read(path .. "/manifest.json") if raw then local manifest = decodeManifest(raw, path) diff --git a/src/mods/Loader.lua b/src/mods/Loader.lua index cc418493..ba92fa95 100644 --- a/src/mods/Loader.lua +++ b/src/mods/Loader.lua @@ -206,7 +206,11 @@ function Loader:_discover() for _, name in ipairs(self.fs.getDirectoryItems(root)) do local path = root .. "/" .. name local info = self.fs.getInfo(path) - if info and info.type == "directory" then + -- a dev-linked mod dir (ln -s) reports type "symlink" even with + -- setSymlinksEnabled(true) -- PhysFS never resolves the symlink's + -- own getInfo, only traversal into it. readManifest below still + -- correctly no-ops on a symlink that isn't a directory. + if info and (info.type == "directory" or info.type == "symlink") then local manifest, err = readManifest(self.fs, path) if manifest then if self.mods[manifest.id] then