mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[utils] Fix cloud save pattern matching to align with EGL
Match the pattern as a suffix, this is valid to catch all files with that exact name in a directory.
This commit is contained in:
parent
8b2809779f
commit
175168adcb
|
@ -22,11 +22,14 @@ def _filename_matches(filename, patterns):
|
|||
"""
|
||||
|
||||
for pattern in patterns:
|
||||
if pattern.endswith('/'):
|
||||
# pat is a directory, check if path starts with it
|
||||
if filename.startswith(pattern):
|
||||
return True
|
||||
elif fnmatch(filename, pattern):
|
||||
# Pattern is a directory, just check if path starts with it
|
||||
if pattern.endswith('/') and filename.startswith(pattern):
|
||||
return True
|
||||
# Check if pattern is a suffix of filename
|
||||
if filename.endswith(pattern):
|
||||
return True
|
||||
# Check if pattern with wildcards ('*') matches
|
||||
if fnmatch(filename, pattern):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue