Remove convert_to_shortened_path from gpui platform

Petros Amoiridis created

Change summary

crates/gpui/src/platform.rs              |  1 
crates/gpui/src/platform/mac/platform.rs | 31 --------------------------
crates/gpui/src/platform/test.rs         |  4 ---
3 files changed, 36 deletions(-)

Detailed changes

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>)>>;

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);
-    }
 }

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(())
     }