Remove convert_to_shortened_path from gpui platform
This commit is contained in:
parent
b4593cd90b
commit
b15632bd45
3 changed files with 0 additions and 36 deletions
|
@ -68,7 +68,6 @@ pub trait Platform: Send + Sync {
|
||||||
fn write_to_clipboard(&self, item: ClipboardItem);
|
fn write_to_clipboard(&self, item: ClipboardItem);
|
||||||
fn read_from_clipboard(&self) -> Option<ClipboardItem>;
|
fn read_from_clipboard(&self) -> Option<ClipboardItem>;
|
||||||
fn open_url(&self, url: &str);
|
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 write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Result<()>;
|
||||||
fn read_credentials(&self, url: &str) -> Result<Option<(String, Vec<u8>)>>;
|
fn read_credentials(&self, url: &str) -> Result<Option<(String, Vec<u8>)>>;
|
||||||
|
|
|
@ -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<()> {
|
fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Result<()> {
|
||||||
let url = CFString::from(url);
|
let url = CFString::from(url);
|
||||||
let username = CFString::from(username);
|
let username = CFString::from(username);
|
||||||
|
@ -1125,23 +1113,4 @@ mod tests {
|
||||||
platform.pasteboard = unsafe { NSPasteboard::pasteboardWithUniqueName(nil) };
|
platform.pasteboard = unsafe { NSPasteboard::pasteboardWithUniqueName(nil) };
|
||||||
platform
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,10 +175,6 @@ impl super::Platform for Platform {
|
||||||
|
|
||||||
fn open_url(&self, _: &str) {}
|
fn open_url(&self, _: &str) {}
|
||||||
|
|
||||||
fn convert_to_shortened_path(&self, _path: &Path) -> PathBuf {
|
|
||||||
PathBuf::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write_credentials(&self, _: &str, _: &str, _: &[u8]) -> Result<()> {
|
fn write_credentials(&self, _: &str, _: &str, _: &[u8]) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue