mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[Launcher] Categorize Lnk files in program plugin correctly as per the target file type (#6348)
* Updated UnregisteredApps code * Added file type checking code and Folder and File classifications * Added more file formats * Removed run as admin for lnk folders * Added script files as executable and changed hashset to case insensitive * Removed runasadmin for generic files * Removed FileTypes enum * Extended ApplicationTypes enum * Fix file format error * Cleaned use of ApplicationType enum to public and match AppType and used ApplicationType in OnAppRenamed * Modify tests to use ApplicationType enum * Added tests for new App types * Modified dummy appref * Mock Directory.Exists and add tests for GetAppTypeFromPath * Combined tests
This commit is contained in:
@@ -69,6 +69,7 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
string newPath = e.FullPath;
|
||||
|
||||
string extension = Path.GetExtension(newPath);
|
||||
Win32Program.ApplicationType appType = Win32Program.GetAppTypeFromPath(newPath);
|
||||
Programs.Win32Program newApp = Programs.Win32Program.GetAppFromPath(newPath);
|
||||
Programs.Win32Program oldApp = null;
|
||||
|
||||
@@ -78,11 +79,11 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
// This situation is not encountered for other application types because the fullPath is the path itself, instead of being computed by using the path to the app.
|
||||
try
|
||||
{
|
||||
if (extension.Equals(LnkExtension, StringComparison.OrdinalIgnoreCase))
|
||||
if (appType == Win32Program.ApplicationType.ShortcutApplication)
|
||||
{
|
||||
oldApp = new Win32Program() { Name = Path.GetFileNameWithoutExtension(e.OldName), ExecutableName = newApp.ExecutableName, FullPath = newApp.FullPath };
|
||||
}
|
||||
else if (extension.Equals(UrlExtension, StringComparison.OrdinalIgnoreCase))
|
||||
else if (appType == Win32Program.ApplicationType.InternetShortcutApplication)
|
||||
{
|
||||
oldApp = new Win32Program() { Name = Path.GetFileNameWithoutExtension(e.OldName), ExecutableName = Path.GetFileName(e.OldName), FullPath = newApp.FullPath };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user