Skip to content

Commit

Permalink
xrGame/fs_registrator_script.cpp: use old vanilla FS functions for va…
Browse files Browse the repository at this point in the history
…nilla scripts

To use new functions with file system types support, you need to use FSType explicitly

P.S. old exist() function was renamed to GetFileDesc() and new functions were introduced under the exist() name.
To prevent any problems with vanilla scripts, this commit reverts the code to the vanilla behaviour
  • Loading branch information
Xottab-DUTY committed Jan 25, 2023
1 parent 6923529 commit e82b258
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/xrGame/fs_registrator_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,6 @@ 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);
}

SCRIPT_EXPORT(fs_registrator, (),
{
using namespace luabind;
Expand Down Expand Up @@ -265,7 +258,13 @@ SCRIPT_EXPORT(fs_registrator, (),
.def("file_length", &CLocatorAPI::file_length)
.def("file_copy", &CLocatorAPI::file_copy)

.def("exist", &ExistS)
.def("exist", &CLocatorAPI::GetFileDesc)
.def("exist", +[](CLocatorAPI* fs, pcstr path, pcstr name)
{
string_path temp;
fs->update_path(temp, path, name);
return fs->GetFileDesc(temp);
})
.def("exist", (FileStatus(CLocatorAPI::*)(LPCSTR, FSType))(&CLocatorAPI::exist))
.def("exist", (FileStatus(CLocatorAPI::*)(LPCSTR, LPCSTR, FSType))(&CLocatorAPI::exist))

Expand Down

0 comments on commit e82b258

Please sign in to comment.