From 75563316f9119ee7e36be7f43885be65e877fad0 Mon Sep 17 00:00:00 2001 From: pablosarm <47988099+pablosarm@users.noreply.github.com> Date: Sat, 26 Sep 2026 00:36:21 -0300 Subject: Fix file picker with inaccessible directory entries (#969) Co-authored-by: Pablo Sarmiento --- backend/decky_loader/utilities.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/backend/decky_loader/utilities.py b/backend/decky_loader/utilities.py index c74ac5d1..99a1b019 100644 --- a/backend/decky_loader/utilities.py +++ b/backend/decky_loader/utilities.py @@ -333,20 +333,24 @@ class Utilities: #Resolving all files/folders in the requested directory for file in path_obj.iterdir(): - if file.exists(): - filest = file.stat() - is_hidden = file.name.startswith('.') - if ON_WINDOWS and not is_hidden: - is_hidden = bool(filest.st_file_attributes & FILE_ATTRIBUTE_HIDDEN) # type: ignore - if include_folders and file.is_dir(): - if (is_hidden and include_hidden) or not is_hidden: - folders.append({"file": file, "filest": filest, "is_dir": True}) - elif include_files: - # Handle requested extensions if present - if include_ext == None or len(include_ext) == 0 or 'all_files' in include_ext \ - or splitext(file.name)[1].lstrip('.').upper() in (ext.upper() for ext in include_ext): + try: + if file.exists(): + filest = file.stat() + is_hidden = file.name.startswith('.') + if ON_WINDOWS and not is_hidden: + is_hidden = bool(filest.st_file_attributes & FILE_ATTRIBUTE_HIDDEN) # type: ignore + if include_folders and file.is_dir(): if (is_hidden and include_hidden) or not is_hidden: - files.append({"file": file, "filest": filest, "is_dir": False}) + folders.append({"file": file, "filest": filest, "is_dir": True}) + elif include_files: + # Handle requested extensions if present + if include_ext == None or len(include_ext) == 0 or 'all_files' in include_ext \ + or splitext(file.name)[1].lstrip('.').upper() in (ext.upper() for ext in include_ext): + if (is_hidden and include_hidden) or not is_hidden: + files.append({"file": file, "filest": filest, "is_dir": False}) + except (PermissionError, OSError): + self.logger.debug(f"Skipping inaccessible file picker entry: {file}") + continue # Filter logic if filter_for is not None: try: -- cgit v1.2.3