mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
Misc
This commit is contained in:
@@ -174,9 +174,14 @@ namespace Wox.Plugin.CMD
|
|||||||
else if (_settings.Shell == Shell.RunCommand)
|
else if (_settings.Shell == Shell.RunCommand)
|
||||||
{
|
{
|
||||||
var parts = command.Split(new[] { ' ' }, 2);
|
var parts = command.Split(new[] { ' ' }, 2);
|
||||||
|
if (parts.Length == 1)
|
||||||
|
{
|
||||||
|
info = new ProcessStartInfo(command);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
var filename = parts[0];
|
var filename = parts[0];
|
||||||
var path = FullPath(filename);
|
if (ExistInPath(filename))
|
||||||
if (string.IsNullOrEmpty(path) || parts.Length == 1)
|
|
||||||
{
|
{
|
||||||
info = new ProcessStartInfo(command);
|
info = new ProcessStartInfo(command);
|
||||||
}
|
}
|
||||||
@@ -190,6 +195,7 @@ namespace Wox.Plugin.CMD
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string arguments;
|
string arguments;
|
||||||
@@ -223,11 +229,11 @@ namespace Wox.Plugin.CMD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string FullPath(string filename)
|
private bool ExistInPath(string filename)
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
return filename;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -236,22 +242,18 @@ namespace Wox.Plugin.CMD
|
|||||||
{
|
{
|
||||||
foreach (var path in values.Split(';'))
|
foreach (var path in values.Split(';'))
|
||||||
{
|
{
|
||||||
var fullPath1 = Path.Combine(path, filename);
|
var path1 = Path.Combine(path, filename);
|
||||||
var fullPath2 = Path.Combine(path, filename + ".exe");
|
var path2 = Path.Combine(path, filename + ".exe");
|
||||||
if (File.Exists(fullPath1))
|
if (File.Exists(path1) || File.Exists(path2))
|
||||||
{
|
{
|
||||||
return fullPath1;
|
return true;
|
||||||
}
|
|
||||||
else if (File.Exists(fullPath2))
|
|
||||||
{
|
|
||||||
return fullPath2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string.Empty;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user