New menu item added to add mpv.net to the path environment variable.

This commit is contained in:
stax76
2023-12-13 09:46:17 +01:00
parent 3eb4af5e75
commit 35b17bc620
4 changed files with 26 additions and 0 deletions

View File

@@ -1,4 +1,8 @@
# v7.0.0.3 Beta (2023-??-??)
- New menu item added at Settings/Setup to add mpv.net to the path environment variable.
# v7.0.0.2 Beta (2023-12-13)
- Besides a portable download there is now again a setup installer.

View File

@@ -204,6 +204,9 @@ mpv.net specific commands
mpv.net commands are used when mpv commands don't exist or lack a feature.
### add-to-path
Adds mpv.net to the Path environment variable.
### load-audio
Shows a file browser dialog to open external audio files.

View File

@@ -45,6 +45,7 @@ public class GuiCommand
["show-menu"] = args => ShowMenu?.Invoke(),
["show-bindings"] = args => ShowBindings(),
["show-playlist"] = args => ShowPlaylist(),
["add-to-path"] = args => AddToPath(),
// deprecated
@@ -263,6 +264,23 @@ public class GuiCommand
public void ShowBindings() => Command.ShowTextWithEditor("Bindings", Player.UsedInputConfContent);
public void AddToPath()
{
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
if (path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower()))
{
Msg.ShowWarning("mpv.net is already in Path.");
return;
}
Environment.SetEnvironmentVariable("Path",
Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path,
EnvironmentVariableTarget.User);
Msg.ShowInfo("mpv.net successfully was added to Path.");
}
public void ShowPlaylist()
{
var count = Player.GetPropertyInt("playlist-count");

View File

@@ -154,6 +154,7 @@ public static class InputHelp
new (_("Settings") + " > " + _("Setup"), _("Register audio file associations"), "script-message-to mpvnet reg-file-assoc audio"),
new (_("Settings") + " > " + _("Setup"), _("Register image file associations"), "script-message-to mpvnet reg-file-assoc image"),
new (_("Settings") + " > " + _("Setup"), _("Unregister file associations"), "script-message-to mpvnet reg-file-assoc unreg"),
new (_("Settings") + " > " + _("Setup"), _("Add mpv.net to Path environment variable"), "script-message-to mpvnet add-to-path"),
new (_("Tools"), _("Set/clear A-B loop points"), "ab-loop", "l"),
new (_("Tools"), _("Toggle infinite file looping"), "cycle-values loop-file inf no", "L"),