mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 03:37:10 +08:00
Merge remote-tracking branch 'origin/V1.2.0' into V1.2.0
This commit is contained in:
commit
691cf1ce72
@ -8,6 +8,7 @@ using System.Threading;
|
||||
using System.Windows;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin.Program.ProgramSources;
|
||||
using IWshRuntimeLibrary;
|
||||
|
||||
namespace Wox.Plugin.Program
|
||||
{
|
||||
@ -55,11 +56,40 @@ namespace Wox.Plugin.Program
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/cmd.png"
|
||||
},
|
||||
new Result()
|
||||
{
|
||||
Title = "Open Containing Folder",
|
||||
Action = _ =>
|
||||
{
|
||||
context.API.HideApp();
|
||||
String Path=c.ExecutePath;
|
||||
//check if shortcut
|
||||
if (Path.EndsWith(".lnk"))
|
||||
{
|
||||
//get location of shortcut
|
||||
Path = ResolveShortcut(Path);
|
||||
}
|
||||
//get parent folder
|
||||
Path=System.IO.Directory.GetParent(Path).FullName;
|
||||
//open the folder
|
||||
context.API.ShellRun("explorer.exe "+Path,false);
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/folder.png"
|
||||
}
|
||||
}
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
static string ResolveShortcut(string filePath)
|
||||
{
|
||||
// IWshRuntimeLibrary is in the COM library "Windows Script Host Object Model"
|
||||
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
|
||||
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
|
||||
return shortcut.TargetPath;
|
||||
}
|
||||
|
||||
private bool MatchProgram(Program program, FuzzyMatcher matcher)
|
||||
{
|
||||
if ((program.Score = matcher.Evaluate(program.Title).Score) > 0) return true;
|
||||
|
@ -121,7 +121,17 @@
|
||||
<Name>Wox.Plugin</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<COMReference Include="IWshRuntimeLibrary">
|
||||
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
Loading…
Reference in New Issue
Block a user