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

Fixed issue with include failing to find embedded files #2272

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/base/_foundation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,23 @@
--

function premake.findProjectScript(fname)
local with_ext = fname .. ".lua"
local p5 = path.join(fname, "premake5.lua")
local p4 = path.join(fname, "premake4.lua")
local filenames = {
fname,
fname .. ".lua",
path.join(fname, "premake5.lua"),
path.join(fname, "premake4.lua"),
}

-- If the currently running script was embedded, try to find this file as if it were embedded too.
if _SCRIPT_DIR and _SCRIPT_DIR:startswith('$') then
table.insert(filenames, path.getabsolute(fname, _SCRIPT_DIR))
end

local compiled_chunk
local res = os.locate(fname, with_ext, p5, p4)
local res = os.locate(table.unpack(filenames))
if res == nil then
local caller = filelineinfo(3)
premake.error(caller .. ": Cannot find neither " .. table.implode({fname, with_ext, p5, p4}, "", "", " nor "))
premake.error(caller .. ": Cannot find neither " .. table.implode(filenames, "", "", " nor "))
else
compiled_chunk, err = loadfile(res)
if err ~= nil then
Expand Down