Browse Source

`egui_extras`: Fix file mime from path (wrong feature name) (#4933)

Fix: features "mime_guess" to "file"

typo: 1

Is this what you intended?
If you intended to add `mime_guess` to `cargo.toml`, please drop it.
pull/5005/head
rustbasic 2 months ago
committed by GitHub
parent
commit
ba80038f3d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      crates/egui/src/data/input.rs
  2. 4
      crates/egui_extras/src/loaders/file_loader.rs

2
crates/egui/src/data/input.rs

@ -719,7 +719,7 @@ impl Modifiers {
} }
/// Checks that the `ctrl/cmd` matches, and that the `shift/alt` of the argument is a subset /// Checks that the `ctrl/cmd` matches, and that the `shift/alt` of the argument is a subset
/// of the pressed ksey (`self`). /// of the pressed key (`self`).
/// ///
/// This means that if the pattern has not set `shift`, then `self` can have `shift` set or not. /// This means that if the pattern has not set `shift`, then `self` can have `shift` set or not.
/// ///

4
crates/egui_extras/src/loaders/file_loader.rs

@ -80,12 +80,12 @@ impl BytesLoader for FileLoader {
move || { move || {
let result = match std::fs::read(&path) { let result = match std::fs::read(&path) {
Ok(bytes) => { Ok(bytes) => {
#[cfg(feature = "mime_guess")] #[cfg(feature = "file")]
let mime = mime_guess2::from_path(&path) let mime = mime_guess2::from_path(&path)
.first_raw() .first_raw()
.map(|v| v.to_owned()); .map(|v| v.to_owned());
#[cfg(not(feature = "mime_guess"))] #[cfg(not(feature = "file"))]
let mime = None; let mime = None;
Ok(File { Ok(File {

Loading…
Cancel
Save