file_manager: minor refactoring in _list_directory method

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-10-30 16:46:40 -04:00
parent aa608b4c29
commit e9b06472c1
1 changed files with 6 additions and 4 deletions

View File

@ -393,10 +393,12 @@ class FileManager:
path_info['filename'] = fname
# Check to see if a filelist update is necessary
ext = os.path.splitext(fname)[-1].lower()
gc_path = self.file_paths.get('gcodes', None)
if gc_path is not None and full_path.startswith(gc_path) and \
ext in VALID_GCODE_EXTS and is_extended:
rel_path = os.path.relpath(full_path, start=gc_path)
if (
root == "gcodes" and
ext in VALID_GCODE_EXTS and
is_extended
):
rel_path = self.get_relative_path(root, full_path)
metadata: Dict[str, Any] = self.gcode_metadata.get(
rel_path, {})
path_info.update(metadata)