mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Fix the problem which Powertoys Run shows duplicated applications. (#37924)
init Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
@@ -96,6 +96,12 @@ namespace Microsoft.Plugin.Program.Storage
|
|||||||
string oldPath = e.OldFullPath;
|
string oldPath = e.OldFullPath;
|
||||||
string newPath = e.FullPath;
|
string newPath = e.FullPath;
|
||||||
|
|
||||||
|
// fix for https://github.com/microsoft/PowerToys/issues/34391
|
||||||
|
// the msi installer creates a shortcut, which is detected by the PT Run and ends up in calling this OnAppRenamed method
|
||||||
|
// the thread needs to be halted for a short time to avoid locking the new shortcut file as we read it, otherwise the lock causes
|
||||||
|
// in the issue scenario that a warning is popping up during the msi install process.
|
||||||
|
System.Threading.Thread.Sleep(1000);
|
||||||
|
|
||||||
string extension = Path.GetExtension(newPath);
|
string extension = Path.GetExtension(newPath);
|
||||||
Win32Program.ApplicationType oldAppType = Win32Program.GetAppTypeFromPath(oldPath);
|
Win32Program.ApplicationType oldAppType = Win32Program.GetAppTypeFromPath(oldPath);
|
||||||
Programs.Win32Program newApp = Win32Program.GetAppFromPath(newPath);
|
Programs.Win32Program newApp = Win32Program.GetAppFromPath(newPath);
|
||||||
|
|||||||
@@ -136,14 +136,9 @@ namespace Wox.Infrastructure
|
|||||||
var link = new ShellLink();
|
var link = new ShellLink();
|
||||||
const int STGM_READ = 0;
|
const int STGM_READ = 0;
|
||||||
|
|
||||||
// Make sure not to open exclusive handles.
|
|
||||||
// See: https://github.com/microsoft/WSL/issues/11276
|
|
||||||
const int STGM_SHARE_DENY_NONE = 0x00000040;
|
|
||||||
const int STGM_TRANSACTED = 0x00010000;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((IPersistFile)link).Load(path, STGM_READ | STGM_SHARE_DENY_NONE | STGM_TRANSACTED);
|
((IPersistFile)link).Load(path, STGM_READ);
|
||||||
}
|
}
|
||||||
catch (System.IO.FileNotFoundException ex)
|
catch (System.IO.FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user