Move initialization of _USER_HOME_DIR to host

This commit is contained in:
Jason Perkins 2015-02-04 18:39:02 -05:00
parent c936229eac
commit 2e76782abc
2 changed files with 8 additions and 2 deletions

View File

@ -56,8 +56,6 @@
_MAIN_SCRIPT_DIR = _WORKING_DIR
end
_USER_HOME_DIR = os.getenv("HOME") or os.getenv("USERPROFILE")
p.callArray(p.main.elements)
-- Look for and run the system-wide configuration script; make sure any

View File

@ -89,6 +89,8 @@ static const luaL_Reg string_functions[] = {
*/
int premake_init(lua_State* L)
{
const char* value;
luaL_register(L, "criteria", criteria_functions);
luaL_register(L, "debug", debug_functions);
luaL_register(L, "path", path_functions);
@ -112,6 +114,12 @@ int premake_init(lua_State* L)
lua_pushstring(L, PLATFORM_STRING);
lua_setglobal(L, "_OS");
/* find the user's home directory */
value = getenv("HOME");
if (!value) value = getenv("USERPROFILE");
lua_pushstring(L, value);
lua_setglobal(L, "_USER_HOME_DIR");
/* publish the initial working directory */
os_getcwd(L);
lua_setglobal(L, "_WORKING_DIR");