Fixed up the builtin

This commit is contained in:
ineed bots
2023-12-03 17:43:40 -06:00
parent 4843c61e2e
commit f0c95340bf
2 changed files with 6 additions and 5 deletions

View File

@ -36,7 +36,7 @@ namespace fileio
{
if (fpath.empty())
{
return false;
return true;
}
constexpr static std::array bad_strings { R"(..)", R"(../)", R"(..\)" };
@ -404,7 +404,8 @@ namespace fileio
gsc::function::add("fs_listfiles", []()
{
auto fpath = build_base_path(game::Scr_GetString(0, game::SCRIPTINSTANCE_SERVER));
std::string dir = game::Scr_GetString(0, game::SCRIPTINSTANCE_SERVER);
auto fpath = build_base_path(dir);
int numfiles;
auto* files = game::FS_ListFiles(fpath.c_str(), "", game::FS_LIST_ALL, &numfiles);
@ -412,7 +413,7 @@ namespace fileio
game::Scr_MakeArray(game::SCRIPTINSTANCE_SERVER);
for (int i = 0; i < numfiles; i++)
{
game::Scr_AddString(game::SCRIPTINSTANCE_SERVER, files[i]);
game::Scr_AddString(game::SCRIPTINSTANCE_SERVER, (dir + "/" + files[i]).c_str());
game::Scr_AddArray(game::SCRIPTINSTANCE_SERVER);
}