From afc4f50300024e66f8b9745a90e778c952efc6c9 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Tue, 5 Aug 2025 00:51:40 +0200 Subject: [PATCH] debugger: Ensure that Python's adapter work dir exists (#35618) Closes #ISSUE cc @Sansui233 who triaged this in https://github.com/zed-industries/zed/issues/35388#issuecomment-3146977431 Release Notes: - debugger: Fixed an issue where a Python debug adapter could not be installed when debugging Python projects for the first time. --- crates/dap_adapters/src/python.rs | 3 +++ crates/zed/src/main.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/crates/dap_adapters/src/python.rs b/crates/dap_adapters/src/python.rs index 455440d6d367bb1b65c7842bde1daa61901639dc..f499244966e05b9acfc4f43251b69b8f0884e006 100644 --- a/crates/dap_adapters/src/python.rs +++ b/crates/dap_adapters/src/python.rs @@ -101,6 +101,9 @@ impl PythonDebugAdapter { .await .context("Could not find Python installation for DebugPy")?; let work_dir = debug_adapters_dir().join(Self::ADAPTER_NAME); + if !work_dir.exists() { + std::fs::create_dir_all(&work_dir)?; + } let mut path = work_dir.clone(); path.push("debugpy-venv"); if !path.exists() { diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 825aea615f88a6bb2b5895f7dcb87d3b2ca67860..71b29909a12277fa092dd2b840da25221652de61 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -1125,6 +1125,7 @@ fn init_paths() -> HashMap> { paths::config_dir(), paths::extensions_dir(), paths::languages_dir(), + paths::debug_adapters_dir(), paths::database_dir(), paths::logs_dir(), paths::temp_dir(),