Skip to content

Commit e9a528e

Browse files
committed
fix: handle dragging multiple files
1 parent 964a126 commit e9a528e

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎player/src/main.rs‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -469,18 +469,13 @@ async fn main() -> std::io::Result<()> {
469469
}
470470
fltk::enums::Event::Paste => {
471471
if dnd && released {
472-
let path = app::event_text();
473-
let path = path.trim();
474-
let path = path.replace("file://", "");
475-
let path = std::path::PathBuf::from(&path);
476-
if path.exists() {
477-
// we use a timeout to avoid pasting the path into the buffer
478-
app::add_timeout3(0.0, {
479-
move |_| {
480-
println!("got dropped file {:?}", path);
481-
tx.send(UIEvent::Play(path.clone())).unwrap();
482-
}
483-
});
472+
for path in app::event_text().split("\n") {
473+
let path = path.trim().replace("file://", "");
474+
let path = std::path::PathBuf::from(&path);
475+
476+
if path.exists() {
477+
tx.send(UIEvent::Play(path.clone())).unwrap();
478+
}
484479
}
485480
dnd = false;
486481
released = false;

0 commit comments

Comments
 (0)