From cc29c8efc7cd33a8afa9b7221625789befeae96e Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 5 Jun 2022 18:54:46 +0100 Subject: [PATCH] GUI: When dropping file, use parent directory for detection The detection was done on the dropped path, so it worked when dropping a directory, but not a file. Now we can drop a file and it will run the detection on the parent directory. --- gui/launcher.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 1dcdfa626d5..c16eed5957e 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -544,7 +544,12 @@ void LauncherDialog::handleKeyUp(Common::KeyState state) { void LauncherDialog::handleOtherEvent(const Common::Event &evt) { Dialog::handleOtherEvent(evt); if (evt.type == Common::EVENT_DROP_FILE) { - doGameDetection(evt.path); + // If the path is a file, take the parent directory for the detection + Common::String path = evt.path; + Common::FSNode node(path); + if (!node.isDirectory()) + path = node.getParent().getPath(); + doGameDetection(path); } }