mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-20 05:53:26 +00:00
rm lj_path_map
This commit is contained in:
parent
7df0342082
commit
2efde665e7
@ -170,7 +170,6 @@ LUALIB_API int luaL_loadbufferx(lua_State *L, const char *buf, size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if LJ_DS_LOADBUFFER_PATCH
|
#if LJ_DS_LOADBUFFER_PATCH
|
||||||
LUA_DATA_API const char* (*lj_path_map)(const char* k) = NULL;
|
|
||||||
LUA_DATA_API int (*lj_need_transform_path)() = NULL;
|
LUA_DATA_API int (*lj_need_transform_path)() = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -180,15 +179,7 @@ LUALIB_API int luaL_loadbuffer(lua_State *L, const char *buf, size_t size,
|
|||||||
#if LJ_DS_LOADBUFFER_PATCH
|
#if LJ_DS_LOADBUFFER_PATCH
|
||||||
if (buf != name && lj_need_transform_path()){
|
if (buf != name && lj_need_transform_path()){
|
||||||
if (name[0] != '@'){
|
if (name[0] != '@'){
|
||||||
if (lj_path_map){
|
if (strncmp(name, "scripts/", sizeof("scripts/") -1) == 0 || strncmp(name , "../mods/", sizeof("../mods/") - 1) == 0) {
|
||||||
const char* real_path = lj_path_map(name);
|
|
||||||
if (real_path){
|
|
||||||
char path[260];
|
|
||||||
snprintf(path, 260, "@%s", real_path);
|
|
||||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strncmp(name, "scripts/", sizeof("scripts/") -1) == 0) {
|
|
||||||
char path[260];
|
char path[260];
|
||||||
snprintf(path, 260, "@%s", name);
|
snprintf(path, 260, "@%s", name);
|
||||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
return luaL_loadbufferx(L, buf, size, path, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user