Skip to content

Commit

Permalink
Make file URI Windows compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
luleyleo committed Nov 3, 2024
1 parent ae5cc97 commit 19c1e5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion gnome/src/search_result/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ impl SearchResult {
Location::Document { page: _, line } => line,
};

let uri = format!("file://{}", absolute_file.as_ref().to_string_lossy());
let uri = if cfg!(target_os = "windows") {
format!("{}", absolute_file.as_ref().to_string_lossy())
} else {
format!("file://{}", absolute_file.as_ref().to_string_lossy())
};

let content = if content.contains('\0') {
println!("Found <NULL> in '{content}'");
Expand Down
2 changes: 1 addition & 1 deletion gnome/src/search_window/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl SearchWindow {
));
}
SearchMessage::Completed { .. } => {
if buffer.len() > 0 {
if !buffer.is_empty() {
model.extend_with_results(&buffer);
app.set_searched_files(app.searched_files() + buffer.len() as u32);
buffer.clear();
Expand Down

0 comments on commit 19c1e5a

Please sign in to comment.