Fix crash on Windows 7 systems without PowerShell.

This commit is contained in:
stax76
2022-03-24 18:32:32 +01:00
parent 1aa380f768
commit 3f469897b0
4 changed files with 52 additions and 26 deletions

View File

@@ -232,15 +232,17 @@ namespace mpvnet
if (!Directory.Exists(_ConfigFolder))
{
using (Process proc = new Process())
{
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = "powershell.exe";
proc.StartInfo.Arguments = $@"-Command New-Item -Path '{_ConfigFolder}' -ItemType Directory";
proc.Start();
proc.WaitForExit();
}
try {
using (Process proc = new Process())
{
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = "powershell.exe";
proc.StartInfo.Arguments = $@"-Command New-Item -Path '{_ConfigFolder}' -ItemType Directory";
proc.Start();
proc.WaitForExit();
}
} catch (Exception) {}
if (!Directory.Exists(_ConfigFolder))
Directory.CreateDirectory(_ConfigFolder);