From 6713ec8cdfbfc9dd949dbc715964cd4764ff92f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Sun, 2 Mar 2025 01:18:34 +0800 Subject: [PATCH] windows: Bring back restoration of tabs (#25870) Closes #25022 Release Notes: - N/A --- crates/util/src/paths.rs | 6 ++++++ crates/workspace/src/persistence/model.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs index f333f285fd..1852f4f44c 100644 --- a/crates/util/src/paths.rs +++ b/crates/util/src/paths.rs @@ -146,6 +146,12 @@ impl From for Arc { } } +impl From for PathBuf { + fn from(sanitized_path: SanitizedPath) -> Self { + sanitized_path.0.as_ref().into() + } +} + impl> From for SanitizedPath { #[cfg(not(target_os = "windows"))] fn from(path: T) -> Self { diff --git a/crates/workspace/src/persistence/model.rs b/crates/workspace/src/persistence/model.rs index b9d0b69ac0..f4c20544db 100644 --- a/crates/workspace/src/persistence/model.rs +++ b/crates/workspace/src/persistence/model.rs @@ -17,7 +17,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::ResultExt; +use util::{paths::SanitizedPath, ResultExt}; use uuid::Uuid; #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] @@ -98,7 +98,7 @@ impl LocalPaths { pub fn new>(paths: impl IntoIterator) -> Self { let mut paths: Vec = paths .into_iter() - .map(|p| p.as_ref().to_path_buf()) + .map(|p| SanitizedPath::from(p).into()) .collect(); // Ensure all future `zed workspace1 workspace2` and `zed workspace2 workspace1` calls are using the same workspace. // The actual workspace order is stored in the `LocalPathsOrder` struct.