1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Added mime field to DroppedFiles (#3273)

This commit is contained in:
Antoine Beyeler
2023-08-23 15:13:47 +02:00
committed by GitHub
parent ec506c0a43
commit 2c5fc5a0a5
4 changed files with 27 additions and 5 deletions

View File

@@ -53,10 +53,18 @@ impl eframe::App for MyApp {
} else {
"???".to_owned()
};
if let Some(bytes) = &file.bytes {
use std::fmt::Write as _;
write!(info, " ({} bytes)", bytes.len()).ok();
let mut additional_info = vec![];
if !file.mime.is_empty() {
additional_info.push(format!("type: {}", file.mime));
}
if let Some(bytes) = &file.bytes {
additional_info.push(format!("{} bytes", bytes.len()));
}
if !additional_info.is_empty() {
info += &format!(" ({})", additional_info.join(", "));
}
ui.label(info);
}
});