From 288013503755f0d44feff6a517169a2861b43f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B1=B1=E9=A2=A8=E9=9C=B2?= Date: Sun, 11 Feb 2024 15:05:52 +0900 Subject: [PATCH] Use try_from_bytes in handle_file_urls (#7652) Reduce build error on Windows. Release Notes: - N/A --- crates/zed/src/open_listener.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/zed/src/open_listener.rs b/crates/zed/src/open_listener.rs index d3ccf753d1..d6fec52df8 100644 --- a/crates/zed/src/open_listener.rs +++ b/crates/zed/src/open_listener.rs @@ -11,15 +11,13 @@ use gpui::{AppContext, AsyncAppContext, Global}; use itertools::Itertools; use language::{Bias, Point}; use release_channel::parse_zed_link; -use std::ffi::OsStr; -use std::os::unix::prelude::OsStrExt; use std::path::Path; use std::sync::atomic::Ordering; use std::sync::Arc; use std::thread; use std::time::Duration; use std::{path::PathBuf, sync::atomic::AtomicBool}; -use util::paths::PathLikeWithPosition; +use util::paths::{PathExt, PathLikeWithPosition}; use util::ResultExt; use workspace::AppState; @@ -129,9 +127,9 @@ impl OpenListener { let paths: Vec<_> = urls .iter() .flat_map(|url| url.strip_prefix("file://")) - .map(|url| { + .flat_map(|url| { let decoded = urlencoding::decode_binary(url.as_bytes()); - PathBuf::from(OsStr::from_bytes(decoded.as_ref())) + PathBuf::try_from_bytes(decoded.as_ref()).log_err() }) .collect();