Replace the standard Lua include path entirely on Windows

The default Lua include path is encoded with the local charset rather
than UTF-8. This causes problems when the working directory includes
non-latin-1 characters which are valid in the local charset, as Aegisub
expects the string to be UTF-8. As the default path isn't very useful on
Windows (on other platforms it could potentially include things like
luarocks-installed modules), just clear it.

Closes #1676.
This commit is contained in:
Thomas Goyne 2013-12-27 14:52:01 -08:00
parent 2c762cf83b
commit 0bca637cea
1 changed files with 5 additions and 1 deletions

View File

@ -382,11 +382,15 @@ namespace Automation4 {
push_value(L, &pairs<table_ipairs>);
lua_setglobal(L, "ipairs");
// add include_path to the module load path
// set the module load path to include_path
lua_getglobal(L, "package");
push_value(L, "path");
#ifdef __WXMSW__
push_value(L, "");
#else
push_value(L, "path");
lua_gettable(L, -3);
#endif
for (auto const& path : include_path) {
lua_pushfstring(L, ";%s/?.lua;%s/?/init.lua", path.string().c_str(), path.string().c_str());