Skip to content

Commit

Permalink
Use try_from_bytes in handle_file_urls (#7652)
Browse files Browse the repository at this point in the history
Reduce build error on Windows.

Release Notes:

- N/A
  • Loading branch information
kazatsuyu authored Feb 11, 2024
1 parent 664a195 commit 2880135
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/zed/src/open_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 2880135

Please sign in to comment.