1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-19 14:26:57 +00:00

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.
This commit is contained in:
nanahi 2023-11-05 22:54:52 -05:00 committed by Kacper Michajłow
parent d2bbd7a531
commit e0b517985b

View File

@ -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 {