diff --git a/crates/paths/src/paths.rs b/crates/paths/src/paths.rs index 870e1e71c68abd09688cf9816967f7f7f2a60588..1fc6ce50e40bc9f2fcee41f606ac8c40bfc60b26 100644 --- a/crates/paths/src/paths.rs +++ b/crates/paths/src/paths.rs @@ -36,6 +36,7 @@ pub fn remote_server_dir_relative() -> &'static RelPath { *CACHED } +// Remove this once 223 goes stable /// Returns the relative path to the zed_wsl_server directory on the wsl host. pub fn remote_wsl_server_dir_relative() -> &'static RelPath { static CACHED: LazyLock<&'static RelPath> = diff --git a/crates/remote/src/transport/wsl.rs b/crates/remote/src/transport/wsl.rs index 9c4b5867de651a4bb7c7644b72db9129ed89c365..2a1b5d5ce144421af8516154fe7869914041a743 100644 --- a/crates/remote/src/transport/wsl.rs +++ b/crates/remote/src/transport/wsl.rs @@ -176,7 +176,7 @@ impl WslRemoteConnection { ); let dst_path = - paths::remote_wsl_server_dir_relative().join(RelPath::unix(&binary_name).unwrap()); + paths::remote_server_dir_relative().join(RelPath::unix(&binary_name).unwrap()); if let Some(parent) = dst_path.parent() { let parent = parent.display(PathStyle::Posix); @@ -200,7 +200,7 @@ impl WslRemoteConnection { ) .await? { - let tmp_path = paths::remote_wsl_server_dir_relative().join( + let tmp_path = paths::remote_server_dir_relative().join( &RelPath::unix(&format!( "download-{}-{}", std::process::id(), diff --git a/crates/remote_server/src/server.rs b/crates/remote_server/src/server.rs index 53aebcf198dd498c5a80008c0b3cafac806f7a33..f656d476a7c47139272717a45828fc0dfa9ce4c5 100644 --- a/crates/remote_server/src/server.rs +++ b/crates/remote_server/src/server.rs @@ -575,8 +575,11 @@ pub fn execute_run( handle_crash_files_requests(&project, &session); - cx.background_spawn(async move { cleanup_old_binaries() }) - .detach(); + cx.background_spawn(async move { + cleanup_old_binaries_wsl(); + cleanup_old_binaries() + }) + .detach(); mem::forget(project); }; @@ -1174,6 +1177,15 @@ fn cleanup_old_binaries() -> Result<()> { Ok(()) } +// Remove this once 223 goes stable, we only have this to clean up old binaries on WSL +// we no longer download them into this folder, we use the same folder as other remote servers +fn cleanup_old_binaries_wsl() { + let server_dir = paths::remote_wsl_server_dir_relative(); + if let Ok(()) = std::fs::remove_dir_all(server_dir.as_std_path()) { + log::info!("removing old wsl remote server folder: {:?}", server_dir); + } +} + fn is_new_version(version: &str) -> bool { semver::Version::from_str(version) .ok()