Keep quotes in args to support args like: -path "s pace"

This commit is contained in:
poke30744 committed 2020-08-17 15:59:35 +09:00
1 parent d20aad136b
commit e1379908c3
1 file changed
+11 -3
+11 -3
View File
@@ -4,6 +4,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using LECommonLibrary;
@@ -88,7 +89,14 @@ namespace LEProc
try
{
Args = args;
var argWithQuotesList = Regex.Matches(Environment.CommandLine, @"[\""].+?[\""]|[^ ]+")
.Cast<Match>()
.ToArray();
Args = new string[argWithQuotesList.Length - 1];
for (var i = 1; i < argWithQuotesList.Length; i += 1)
{
Args[i - 1] = argWithQuotesList[i].ToString();
}
switch (Args[0])
{
@@ -112,9 +120,9 @@ namespace LEProc
break;
default:
if (File.Exists(Args[0]))
if (File.Exists(Args[0].Trim('"')))
{
RunWithDefaultProfile(Args[0]);
RunWithDefaultProfile(Args[0].Trim('"'));
}
break;
}