Skip to content

Commit

Permalink
Add FS:exist script function overload.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Oct 9, 2015
1 parent 0695376 commit 3c23c42
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/xrGame/fs_registrator_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ LPCSTR get_file_age_str(CLocatorAPI* fs, LPCSTR nm)
return asctime( newtime );
}

static const CLocatorAPI::file *ExistS(CLocatorAPI *fs, const char *path, const char *name)
{
string_path temp;
fs->update_path(temp, path, name);
return fs->GetFileDesc(temp);
}

#pragma optimize("s",on)
void fs_registrator::script_register(lua_State *L)
{
Expand Down Expand Up @@ -231,6 +238,7 @@ void fs_registrator::script_register(lua_State *L)
.def("file_length", &CLocatorAPI::file_length)
.def("file_copy", &CLocatorAPI::file_copy)

.def("exist", &ExistS)
.def("exist", (FileStatus (CLocatorAPI::*)(LPCSTR, FSType))(&CLocatorAPI::exist))
.def("exist", (FileStatus (CLocatorAPI::*)(LPCSTR, LPCSTR, FSType))(&CLocatorAPI::exist))

Expand Down

0 comments on commit 3c23c42

Please sign in to comment.