diff --git a/docs/Changelog.md b/docs/Changelog.md
index 8d3154b..3d90e65 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -4,6 +4,7 @@
- Creating a playlist from a folder uses absolute normalized paths, non media files are ignored.
- The basic view of the show-info command was removed, the advanced view was enhanced with a General section and the filename.
- Media info titles are shortened if they contain duplicated or obvious information.
+- Support of shortcuts (.lnk files) with media file target.
- Fix OSC hide behavior on mouse move.
- MediaInfo v22.06
- libmpv shinchiro 2022-07-02
diff --git a/src/Misc/Player.cs b/src/Misc/Player.cs
index e0bab5c..9933c0f 100644
--- a/src/Misc/Player.cs
+++ b/src/Misc/Player.cs
@@ -1202,8 +1202,11 @@ namespace mpvnet
string ext = file.Ext();
- if (ext == "avs")
- LoadAviSynth();
+ switch (ext)
+ {
+ case "avs": LoadAviSynth(); break;
+ case "lnk": file = GetShortcutTarget(file); break;
+ }
if (ext == "iso")
LoadISO(file);
@@ -1461,6 +1464,13 @@ namespace mpvnet
return name;
}
+ public static string GetShortcutTarget(string path)
+ {
+ Type t = Type.GetTypeFromProgID("WScript.Shell");
+ dynamic sh = Activator.CreateInstance(t);
+ return sh.CreateShortcut(path).TargetPath;
+ }
+
public void RaiseScaleWindow(float value) => ScaleWindow(value);
public void RaiseWindowScaleNET(float value) => WindowScaleNET(value);
diff --git a/src/mpv.net.csproj b/src/mpv.net.csproj
index 431779e..647af62 100644
--- a/src/mpv.net.csproj
+++ b/src/mpv.net.csproj
@@ -69,6 +69,7 @@
MinimumRecommendedRules.ruleset
+