From 97d97eb37c738d542602b3ffb209dcbdf4144aa7 Mon Sep 17 00:00:00 2001 From: chexit Date: Sat, 21 Nov 2026 15:43:48 +0300 Subject: [PATCH] Keep a broken DLSS cache directory from failing the build Scanning .horizon-cache/dlss-sdk is best-effort: a permissions error or a missing directory now means "nothing cached" and the normal install path runs, instead of an exception escaping before the mods fallback. Co-Authored-By: Kimi Code --- tools/airdef.py | 13 +++++++------ tools/test_airdef_build.py | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/airdef.py b/tools/airdef.py index 0864dc9..b119a19 100644 --- a/tools/airdef.py +++ b/tools/airdef.py @@ -245,12 +245,13 @@ def dlss_tag_key(name): def cached_dlss_sdk(): """Самый новый полностью скачанный SDK в кэше или None.""" - if not DLSS_CACHE.is_dir(): - return None - for path in sorted(DLSS_CACHE.iterdir(), key=lambda p: dlss_tag_key(p.name), reverse=True): - state = read_marker(path) - if state and state.get("tag") == path.name and dlss_sdk_complete(path): - return path + try: + for path in sorted(DLSS_CACHE.iterdir(), key=lambda p: dlss_tag_key(p.name), reverse=True): + state = read_marker(path) + if state and state.get("tag") == path.name and dlss_sdk_complete(path): + return path + except OSError: + pass return None diff --git a/tools/test_airdef_build.py b/tools/test_airdef_build.py index fb91430..3ac0606 100644 --- a/tools/test_airdef_build.py +++ b/tools/test_airdef_build.py @@ -284,6 +284,11 @@ class DlssAutoInstallTests(unittest.TestCase): self.assertTrue((root / airdef.DLSS_RUNTIME).is_file()) self.assertGreater(len(self.downloads), count) + def test_missing_cache_is_not_an_error(self): + self.assertFalse(self.dlss_cache.exists()) + self.assertIsNone(airdef.cached_dlss_sdk()) + self.assertIsNone(airdef.cached_vulkan_headers()) + def test_vulkan_headers_land_under_capital_include(self): root = airdef.install_vulkan_headers() self.assertEqual(root, self.vulkan_cache / airdef.VULKAN_TAG_PINNED)