mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 16:08:40 +01:00
Fix extensionless files in foobar
This commit is contained in:
parent
e43ea98f6f
commit
57197d601d
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user