Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
revert e137990
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed Aug 25, 2021
1 parent 8e98b5d commit db03abf
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions LEProc/Program.cs
Expand Up @@ -4,7 +4,6 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using LECommonLibrary;

Expand Down Expand Up @@ -89,17 +88,7 @@ private static void Main(string[] args)

try
{
// To keep original quotes in the command line. If we directly use args[] to make the command line,
// {_cmd1.exe / c _cmd2.exe "path with space"} will become {_cmd1.exe / c _cmd2.exe path with space}
// and will cause issues.
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();
}
Args = args;

switch (Args[0])
{
Expand All @@ -123,9 +112,9 @@ private static void Main(string[] args)
break;

default:
if (File.Exists(Args[0].Trim('"')))
if (File.Exists(Args[0]))
{
RunWithDefaultProfile(Args[0].Trim('"'));
RunWithDefaultProfile(Args[0]);
}
break;
}
Expand Down

0 comments on commit db03abf

Please sign in to comment.