New menu item added to add mpv.net to the path environment variable.
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user