summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2023-11-05 22:54:52 -0500
committerKacper Michajłow <kasper93@gmail.com>2024-03-19 11:34:00 +0100
commite0b517985bb0baafa3581cb768d8a9ce4126b6a8 (patch)
tree43151795ea6e4e7e179f46220b0c7227a3ce3363 /video/out
parentd2bbd7a531567fe9c41a56e5ab3b6255e771a5aa (diff)
downloadmpv-e0b517985bb0baafa3581cb768d8a9ce4126b6a8.tar.bz2
mpv-e0b517985bb0baafa3581cb768d8a9ce4126b6a8.tar.xz
win32: resolve dropped shell links (Windows shortcuts)
When a shell link is dropped onto the mpv window, the file name will be replaced by the file name of its target so that the linked file is played.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/win32/droptarget.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/video/out/win32/droptarget.c b/video/out/win32/droptarget.c
index b1b4824d9c..fdf9c7a097 100644
--- a/video/out/win32/droptarget.c
+++ b/video/out/win32/droptarget.c
@@ -157,8 +157,10 @@ static STDMETHODIMP DropTarget_Drop(IDropTarget *self, IDataObject *pDataObj,
wchar_t *buf = talloc_array(NULL, wchar_t, len + 1);
if (DragQueryFileW(drop, i, buf, len + 1) == len) {
- char *fname = mp_to_utf8(files, buf);
+ wchar_t *target = mp_w32_get_shell_link_target(buf);
+ char *fname = mp_to_utf8(files, target ? target : buf);
files[recvd_files++] = fname;
+ talloc_free(target);
MP_VERBOSE(t, "received dropped file: %s\n", fname);
} else {