diff --git a/assets/dl.lua b/assets/dl.lua index 87dd01cfd..f60dd77a8 100644 --- a/assets/dl.lua +++ b/assets/dl.lua @@ -91,14 +91,20 @@ function dl.dlopen(library, load_func, depth) local padding = depth * 4 for pspec in string.gmatch( - library:sub(1, 1) == "/" and "" or dl.library_path, + library:sub(1, 1) == "/" and "/" or dl.library_path, "([^;:]+)") do - local lname, matches = string.gsub(pspec, "%?", library) - if matches == 0 then - -- if pathspec does not contain a '?', - -- we append the library name to the pathspec - lname = lname .. '/' .. library + local lname + if library:sub(1, 1) == "/" and pspec == "/" then + lname = library + else + local matches + lname, matches = string.gsub(pspec, "%?", library) + if matches == 0 then + -- if pathspec does not contain a '?', + -- we append the library name to the pathspec + lname = lname .. '/' .. library + end end local ok, lib = pcall(Elf.open, lname)