[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:
derrod 2023-06-17 20:24:40 +02:00
parent 8b2809779f
commit 175168adcb

View file

@ -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):
# Pattern is a directory, just check if path starts with it
if pattern.endswith('/') and filename.startswith(pattern):
return True
elif fnmatch(filename, pattern):
# 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