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

Revert "Improve error message of include #2120

Closed
Closed
Show file tree
Hide file tree
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
10 changes: 1 addition & 9 deletions src/base/_foundation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,7 @@
--

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

local res = os.locate(fname, with_ext, p5, p4)
if res == nil then
premake.error("Cannot find either " .. table.implode({fname, with_ext, p5, p4}, "", "", " or "))
end
return res
return os.locate(fname, fname .. ".lua", path.join(fname, "premake5.lua"), path.join(fname, "premake4.lua"))
end


Expand Down
3 changes: 2 additions & 1 deletion src/base/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@
---

function includeexternal(fname)
fname = p.findProjectScript(fname)
local fullPath = p.findProjectScript(fname)
local wasIncludingExternal = api._isIncludingExternal
api._isIncludingExternal = true
fname = fullPath or fname
dofile(fname)
api._isIncludingExternal = wasIncludingExternal
end
Expand Down
3 changes: 2 additions & 1 deletion src/base/globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
io._includedFiles = {}

function include(fname)
fname = premake.findProjectScript(fname)
local fullPath = premake.findProjectScript(fname)
fname = fullPath or fname
if not io._includedFiles[fname] then
io._includedFiles[fname] = true
return dofile(fname)
Expand Down