Follow symlinks
This commit is contained in:
parent
fd76fba235
commit
ed53888fce
@ -55,11 +55,10 @@ inline bool lua_function_exists(lua_State *lua_state, const char *name)
|
|||||||
// See http://lua-users.org/wiki/PackagePath for details on the package.path syntax.
|
// See http://lua-users.org/wiki/PackagePath for details on the package.path syntax.
|
||||||
inline void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_name)
|
inline void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_name)
|
||||||
{
|
{
|
||||||
const boost::filesystem::path profile_path(file_name);
|
boost::filesystem::path profile_path = boost::filesystem::canonical(file_name);
|
||||||
std::string folder = profile_path.parent_path().string();
|
std::string folder = profile_path.parent_path().string();
|
||||||
// TODO: This code is most probably not Windows safe since it uses UNIX'ish path delimiters
|
// TODO: This code is most probably not Windows safe since it uses UNIX'ish path delimiters
|
||||||
const std::string lua_code =
|
const std::string lua_code = "package.path = \"" + folder + "/?.lua;\" .. package.path";
|
||||||
"package.path = \"" + folder + "/?.lua;" + folder + "/profiles/?.lua;profiles/?.lua;\" .. package.path";
|
|
||||||
luaL_dostring(lua_state, lua_code.c_str());
|
luaL_dostring(lua_state, lua_code.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user