Allow searching Windows paths with forward slash (#35198)
Release Notes: - Searching windows paths is now possible with a forward slash
This commit is contained in:
parent
a8bdf30259
commit
511fdaed43
1 changed files with 14 additions and 7 deletions
|
@ -1404,14 +1404,21 @@ impl PickerDelegate for FileFinderDelegate {
|
|||
} else {
|
||||
let path_position = PathWithPosition::parse_str(&raw_query);
|
||||
|
||||
#[cfg(windows)]
|
||||
let raw_query = raw_query.trim().to_owned().replace("/", "\\");
|
||||
#[cfg(not(windows))]
|
||||
let raw_query = raw_query.trim().to_owned();
|
||||
|
||||
let file_query_end = if path_position.path.to_str().unwrap_or(&raw_query) == raw_query {
|
||||
None
|
||||
} else {
|
||||
// Safe to unwrap as we won't get here when the unwrap in if fails
|
||||
Some(path_position.path.to_str().unwrap().len())
|
||||
};
|
||||
|
||||
let query = FileSearchQuery {
|
||||
raw_query: raw_query.trim().to_owned(),
|
||||
file_query_end: if path_position.path.to_str().unwrap_or(raw_query) == raw_query {
|
||||
None
|
||||
} else {
|
||||
// Safe to unwrap as we won't get here when the unwrap in if fails
|
||||
Some(path_position.path.to_str().unwrap().len())
|
||||
},
|
||||
raw_query,
|
||||
file_query_end,
|
||||
path_position,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue