diff options
| author | pablosarm <47988099+pablosarm@users.noreply.github.com> | 2026-09-26 00:36:21 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-25 23:36:21 -0400 |
| commit | 75563316f9119ee7e36be7f43885be65e877fad0 (patch) | |
| tree | 1274640b6a0b95308d53c3c54181003c4da7cb6f /backend/decky_loader/utilities.py | |
| parent | 84288115c8db0abe40061df0612567ab4ac81967 (diff) | |
| download | decky-loader-3.2.10-pre1.tar.gz decky-loader-3.2.10-pre1.zip | |
Fix file picker with inaccessible directory entries (#969)HEADv3.2.10-pre1main
Co-authored-by: Pablo Sarmiento <pablo@local>
Diffstat (limited to 'backend/decky_loader/utilities.py')
| -rw-r--r-- | backend/decky_loader/utilities.py | 30 |
1 files 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: |
