Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove convert_to_shortened_path from gpui platform
Petros Amoiridisb15632bd453b
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rsindex 482de941628..538b46ee777 100644--- a/crates/gpui/src/platform.rs+++ b/crates/gpui/src/platform.rs@@ -68,7 +68,6 @@ pub trait Platform: Send + Sync {fn write_to_clipboard(&self, item: ClipboardItem);fn read_from_clipboard(&self) -> Option<ClipboardItem>;fn open_url(&self, url: &str);- fn convert_to_shortened_path(&self, path: &Path) -> PathBuf;fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Result<()>;fn read_credentials(&self, url: &str) -> Result<Option<(String, Vec<u8>)>>;diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rsindex d9ac7237cef..ab4fd873c64 100644--- a/crates/gpui/src/platform/mac/platform.rs+++ b/crates/gpui/src/platform/mac/platform.rs@@ -674,18 +674,6 @@ impl platform::Platform for MacPlatform {}}- fn convert_to_shortened_path(&self, path: &Path) -> PathBuf {- match path.strip_prefix(util::paths::HOME.as_path()) {- Ok(relative_path) => {- let mut shortened_path = PathBuf::new();- shortened_path.push("~");- shortened_path.push(relative_path);- shortened_path- }- Err(_) => path.to_path_buf(),- }- }-fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Result<()> {let url = CFString::from(url);let username = CFString::from(username);@@ -1125,23 +1113,4 @@ mod tests {platform.pasteboard = unsafe { NSPasteboard::pasteboardWithUniqueName(nil) };platform}-- #[test]- fn test_convert_to_shortened_path() {- let platform = build_platform();-- let full_path: PathBuf = [- util::paths::HOME.to_string_lossy().to_string(),- "a".to_string(),- "b".to_string(),- "c".to_string(),- ]- .iter()- .collect();-- let shortened_path_actual = platform.convert_to_shortened_path(&full_path);- let shortened_path_expected = PathBuf::from("~/a/b/c");-- assert_eq!(shortened_path_actual, shortened_path_expected);- }}diff --git a/crates/gpui/src/platform/test.rs b/crates/gpui/src/platform/test.rsindex 6b1cdf5e054..a3532dd96e1 100644--- a/crates/gpui/src/platform/test.rs+++ b/crates/gpui/src/platform/test.rs@@ -175,10 +175,6 @@ impl super::Platform for Platform {fn open_url(&self, _: &str) {}- fn convert_to_shortened_path(&self, _path: &Path) -> PathBuf {- PathBuf::new()- }-fn write_credentials(&self, _: &str, _: &str, _: &[u8]) -> Result<()> {Ok(())}