Skip to content

Commit

Permalink
Revert "Improve error message of include"
Browse files Browse the repository at this point in the history
  • Loading branch information
nickclark2016 authored Aug 10, 2023
1 parent 723992c commit 5aa7fae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
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

0 comments on commit 5aa7fae

Please sign in to comment.