Fix bug in RPak auto completion

RPaks that have a name larger than 123 chars will have their extension delimiter removed due to the way 'CAutoCompleteFileList::AutoCompletionFunc' works. Ideally this functions receives a full rewrite in the SDK to support dynamic extension lengths.
This commit is contained in:
Kawe Mazidjatari 2023-02-06 21:46:03 +01:00
parent 99b057438f
commit f9245a4070

View File

@ -66,13 +66,13 @@ int _Host_Pak_f_CompletionFunc(CAutoCompleteFileList* autocomplete, char const*
for (size_t i = 0; i < count; i++)
{
size_t cmdsize = strlen(commands[i]);
if (cmdsize < COMMAND_COMPLETION_ITEM_LENGTH - 4)
if (cmdsize < COMMAND_COMPLETION_ITEM_LENGTH - 5)
{
snprintf(&commands[i][cmdsize], 5, "%s", "rpak");
}
else
{
snprintf(commands[i], COMMAND_COMPLETION_ITEM_LENGTH, "%s", "BUFFER_TOO_SMALL");
snprintf(commands[i], COMMAND_COMPLETION_ITEM_LENGTH, "%s", "BUFFER_TOO_SMALL!");
}
}
}