Fix extensionless files in foobar

This commit is contained in:
bnnm 2022-08-14 12:23:03 +02:00
parent e43ea98f6f
commit 57197d601d

View File

@ -9,9 +9,9 @@
/* ****************************************** */
int vgmstream_ctx_is_valid(const char* filename, vgmstream_ctx_valid_cfg *cfg) {
const char ** extension_list;
const char** extension_list;
size_t extension_list_len;
const char *extension;
const char* extension;
int i;
@ -21,12 +21,12 @@ int vgmstream_ctx_is_valid(const char* filename, vgmstream_ctx_valid_cfg *cfg) {
extension = filename_extension(filename);
}
/* some metas accept extensionless files, but make sure it's not a path */
/* some metas accept extensionless files, but make sure it's not a path (unlikely but...) */
if (strlen(extension) <= 0) {
int len = strlen(filename);
if (len <= 0)
int len = strlen(filename); /* foobar passes an extension as so len may be still 0 */
if (len <= 0 && !cfg->is_extension)
return 0;
if (filename[len - 1] == '/' || filename[len - 1] == '\\')
if (len > 1 && (filename[len - 1] == '/' || filename[len - 1] == '\\'))
return 0;
return !cfg->reject_extensionless;
}