From a58ed7343d266a14332ad4243b6fb16146ccee94 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 7 Jul 2014 09:06:47 -0700 Subject: [PATCH] Add Aegisub's include dirs before the system ones rather than after --- libaegisub/lua/script_reader.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libaegisub/lua/script_reader.cpp b/libaegisub/lua/script_reader.cpp index 430f5042d..6270948ab 100644 --- a/libaegisub/lua/script_reader.cpp +++ b/libaegisub/lua/script_reader.cpp @@ -123,20 +123,21 @@ namespace agi { namespace lua { // set the module load path to include_path lua_getglobal(L, "package"); push_value(L, "path"); -#ifdef _WIN32 - // No point in checking any of the default locations on Windows since - // there won't be anything there - push_value(L, ""); -#else - push_value(L, "path"); - lua_gettable(L, -3); -#endif + push_value(L, ""); for (auto const& path : include_path) { - lua_pushfstring(L, ";%s/?.lua;%s/?/init.lua", path.string().c_str(), path.string().c_str()); + lua_pushfstring(L, "%s/?.lua;%s/?/init.lua;", path.string().c_str(), path.string().c_str()); lua_concat(L, 2); } +#ifndef _WIN32 + // No point in checking any of the default locations on Windows since + // there won't be anything there + push_value(L, "path"); + lua_gettable(L, -4); + lua_concat(L, 2); +#endif + lua_settable(L, -3); // Replace the default lua module loader with our unicode compatible one