mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 01:10:51 +00:00
Lunatic-m32: take over load path.
git-svn-id: https://svn.eduke32.com/eduke32@3059 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2851f412d2
commit
36687ab986
3 changed files with 39 additions and 0 deletions
|
@ -263,6 +263,18 @@ static searchpath_t *searchpathhead = NULL;
|
||||||
static size_t maxsearchpathlen = 0;
|
static size_t maxsearchpathlen = 0;
|
||||||
int32_t pathsearchmode = 0;
|
int32_t pathsearchmode = 0;
|
||||||
|
|
||||||
|
char *listsearchpath(int32_t initp)
|
||||||
|
{
|
||||||
|
static searchpath_t *sp;
|
||||||
|
|
||||||
|
if (initp)
|
||||||
|
sp = searchpathhead;
|
||||||
|
else if (sp != NULL)
|
||||||
|
sp = sp->next;
|
||||||
|
|
||||||
|
return sp ? sp->path : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t addsearchpath(const char *p)
|
int32_t addsearchpath(const char *p)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
|
@ -29,3 +29,26 @@ sectorsofbunch = defs_c.sectorsofbunch
|
||||||
getbunch = defs_c.getbunch
|
getbunch = defs_c.getbunch
|
||||||
|
|
||||||
hitscan = defs_c.hitscan
|
hitscan = defs_c.hitscan
|
||||||
|
|
||||||
|
|
||||||
|
--== Mapster32-specific initialization
|
||||||
|
|
||||||
|
ffi.cdef "char *listsearchpath(int32_t initp);"
|
||||||
|
|
||||||
|
-- Add the search path directories to the Lua load path.
|
||||||
|
local initp = 1
|
||||||
|
while (true) do
|
||||||
|
local sp_c = ffiC.listsearchpath(initp)
|
||||||
|
|
||||||
|
if (sp_c == nil) then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
local sp = ffi.string(sp_c)
|
||||||
|
assert(sp:sub(-1)=='/')
|
||||||
|
package.path = sp..'?.lua;'..package.path
|
||||||
|
|
||||||
|
initp = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
--print('Lua load path: '..package.path)
|
||||||
|
|
|
@ -32,4 +32,8 @@ hitscan;
|
||||||
rotatesprite;
|
rotatesprite;
|
||||||
|
|
||||||
gethitickms;
|
gethitickms;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
listsearchpath;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue