Fix #2362 by using generic path strings

In windows native strings in Lua incorrectly
interpreted because native separators must be escaped.
Use of generic strings prevent use of backslashes and
"Generic paths are portable and independent of the operating system.".
This commit is contained in:
Michael Krasnyk 2016-05-05 11:19:27 +02:00
parent a2d83753bc
commit c87ae5612a

View File

@ -43,8 +43,7 @@ inline bool luaFunctionExists(lua_State *lua_state, const char *name)
inline void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_name)
{
boost::filesystem::path profile_path = boost::filesystem::canonical(file_name);
std::string folder = profile_path.parent_path().string();
// TODO: This code is most probably not Windows safe since it uses UNIX'ish path delimiters
std::string folder = profile_path.parent_path().generic_string();
const std::string lua_code = "package.path = \"" + folder + "/?.lua;\" .. package.path";
luaL_dostring(lua_state, lua_code.c_str());
}