From 0bca637cea8bf108a2683cc8a232e1ed5533ee1d Mon Sep 17 00:00:00 2001
From: Thomas Goyne <plorkyeran@aegisub.org>
Date: Fri, 27 Dec 2013 14:52:01 -0800
Subject: [PATCH] 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.
---
 aegisub/src/auto4_lua.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/aegisub/src/auto4_lua.cpp b/aegisub/src/auto4_lua.cpp
index 570a058b4..268f49d92 100644
--- a/aegisub/src/auto4_lua.cpp
+++ b/aegisub/src/auto4_lua.cpp
@@ -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());
-- 
GitLab