Skip to content

Commit eb7b44d

Browse files
committed
Fixed issue with include failing to find embedded files
1 parent 6d3c962 commit eb7b44d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/base/_foundation.lua

+13-5
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,23 @@
238238
--
239239

240240
function premake.findProjectScript(fname)
241-
local with_ext = fname .. ".lua"
242-
local p5 = path.join(fname, "premake5.lua")
243-
local p4 = path.join(fname, "premake4.lua")
241+
local filenames = {
242+
fname,
243+
fname .. ".lua",
244+
path.join(fname, "premake5.lua"),
245+
path.join(fname, "premake4.lua"),
246+
}
247+
248+
-- If the currently running script was embedded, try to find this file as if it were embedded too.
249+
if _SCRIPT_DIR and _SCRIPT_DIR:startswith('$') then
250+
table.insert(filenames, path.getabsolute(fname, _SCRIPT_DIR))
251+
end
244252

245253
local compiled_chunk
246-
local res = os.locate(fname, with_ext, p5, p4)
254+
local res = os.locate(table.unpack(filenames))
247255
if res == nil then
248256
local caller = filelineinfo(3)
249-
premake.error(caller .. ": Cannot find neither " .. table.implode({fname, with_ext, p5, p4}, "", "", " nor "))
257+
premake.error(caller .. ": Cannot find neither " .. table.implode(filenames, "", "", " nor "))
250258
else
251259
compiled_chunk, err = loadfile(res)
252260
if err ~= nil then

0 commit comments

Comments
 (0)