Improve built-in package search paths; begin standardizing on "modules" terminology
This commit is contained in:
parent
bb18026fcc
commit
3b5611503f
@ -3,7 +3,7 @@
|
||||
--
|
||||
-- Prepares the runtime environment for the add-ons and user project scripts.
|
||||
--
|
||||
-- Copyright (c) 2012 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
@ -12,6 +12,27 @@
|
||||
-- at least some if not all of this moved into add-ons in the future.
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- Set the default module search paths. Modules will generally live in a
|
||||
-- folder of the same name: ninja/ninja.lua. The search order is the same
|
||||
-- as what is specified here.
|
||||
--
|
||||
|
||||
local home = os.getenv("HOME") or os.getenv("USERPROFILE")
|
||||
|
||||
local packagePaths = {
|
||||
path.join(home, ".premake/?/?.lua"),
|
||||
"./modules/?/?.lua",
|
||||
path.join(path.getdirectory(_PREMAKE_COMMAND), "modules/?/?.lua"),
|
||||
path.join(home, "Library/Application Support/Premake/?/?.lua"),
|
||||
"/usr/local/share/premake/?/?.lua",
|
||||
"/usr/share/premake/?/?.lua",
|
||||
}
|
||||
|
||||
package.path = table.concat(packagePaths, ";")
|
||||
|
||||
|
||||
--
|
||||
-- Use Posix-style target naming by default, since it is the most common.
|
||||
--
|
||||
|
@ -29,25 +29,6 @@
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Now that the scripts are loaded, I can use path.getabsolute() to properly
|
||||
-- canonicalize the executable path.
|
||||
|
||||
_PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND)
|
||||
|
||||
-- Enable extensions - the '?' character is replaced with the extension
|
||||
-- name so the extension directory name _must_ be the same as the
|
||||
-- extension Lua file. eg. .../d/d.lua, .../codelite/codelite.lua etc
|
||||
local home = os.getenv("HOME") or os.getenv("USERPROFILE")
|
||||
local extdirs = {
|
||||
home .. "/.premake/?/?.lua",
|
||||
path.getdirectory( _PREMAKE_COMMAND ) .. "/ext/?/?.lua",
|
||||
"./premake/?/?.lua",
|
||||
"/usr/share/premake/?/?.lua" }
|
||||
for _,v in ipairs(extdirs) do
|
||||
package.path = package.path .. ";" .. v
|
||||
end
|
||||
|
||||
-- The "next-gen" actions have now replaced their deprecated counterparts.
|
||||
-- Provide a warning for a little while before I remove them entirely.
|
||||
if _ACTION and _ACTION:endswith("ng") then
|
||||
|
@ -16,14 +16,16 @@ int main(int argc, const char** argv)
|
||||
z = premake_init(L);
|
||||
|
||||
/* push the location of the Premake executable */
|
||||
lua_pushcfunction(L, path_getabsolute);
|
||||
premake_locate(L, argv[0]);
|
||||
lua_call(L, 1, 1);
|
||||
lua_setglobal(L, "_PREMAKE_COMMAND");
|
||||
|
||||
if (z == OKAY)
|
||||
{
|
||||
z = premake_execute(L, argc, argv);
|
||||
}
|
||||
|
||||
|
||||
lua_close(L);
|
||||
return z;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user