virtual_sdcard: fix check for case sensitive files

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-05-08 18:24:50 -04:00 committed by KevinOConnor
parent 8eef1e2146
commit dc71b64c0a
1 changed files with 2 additions and 1 deletions

View File

@ -152,10 +152,11 @@ class VirtualSD:
self._load_file(gcmd, filename) self._load_file(gcmd, filename)
def _load_file(self, gcmd, filename, check_subdirs=False): def _load_file(self, gcmd, filename, check_subdirs=False):
files = self.get_file_list(check_subdirs) files = self.get_file_list(check_subdirs)
flist = [f[0] for f in files]
files_by_lower = { fname.lower(): fname for fname, fsize in files } files_by_lower = { fname.lower(): fname for fname, fsize in files }
fname = filename fname = filename
try: try:
if fname not in files: if fname not in flist:
fname = files_by_lower[fname.lower()] fname = files_by_lower[fname.lower()]
fname = os.path.join(self.sdcard_dirname, fname) fname = os.path.join(self.sdcard_dirname, fname)
f = open(fname, 'rb') f = open(fname, 'rb')