Skip to content

Commit c93ee5e

Browse files
committed
Lua: Fix package path using parent autorun path
1 parent 517b299 commit c93ee5e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/mods/ScriptRunner.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -1220,14 +1220,11 @@ void ScriptRunner::reset_scripts() {
12201220
std::filesystem::create_directories(autorun_path);
12211221
spdlog::info("[ScriptRunner] Loading scripts...");
12221222

1223-
auto path = std::filesystem::path(autorun_path);
1224-
auto dir = path.parent_path();
1225-
12261223
std::string old_path = m_main_state->lua()["package"]["path"];
12271224

1228-
std::string package_path = old_path + ";" + dir.string() + "/?.lua";
1229-
package_path = package_path + ";" + dir.string() + "/?/init.lua";
1230-
package_path = package_path + ";" + dir.string() + "/?.dll";
1225+
std::string package_path = old_path + ";" + autorun_path.string() + "/?.lua";
1226+
package_path = package_path + ";" + autorun_path.string() + "/?/init.lua";
1227+
package_path = package_path + ";" + autorun_path.string() + "/?.dll";
12311228

12321229
m_main_state->lua()["package"]["path"] = package_path;
12331230

0 commit comments

Comments
 (0)