mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[PTRun][Program]Fix bug when renaming url shortcut (#17184)
* [PTRun][Program]Fix bug when renaming url shortcut * Try to use the old full path for old app removal * Guard against links to nowhere * Fix test to have link point to existing location * Update src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Fix nit. Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
This commit is contained in:
@@ -352,10 +352,11 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
|
||||
string oldFullPath = directory + "\\" + oldpath;
|
||||
string fullPath = directory + "\\" + path;
|
||||
string linkingTo = Directory.GetCurrentDirectory();
|
||||
|
||||
// ShellLinkHelper must be mocked for lnk applications
|
||||
var mockShellLink = new Mock<IShellLinkHelper>();
|
||||
mockShellLink.Setup(m => m.RetrieveTargetPath(It.IsAny<string>())).Returns(string.Empty);
|
||||
mockShellLink.Setup(m => m.RetrieveTargetPath(It.IsAny<string>())).Returns(linkingTo);
|
||||
Win32Program.ShellLinkHelper = mockShellLink.Object;
|
||||
|
||||
// old item and new item are the actual items when they are in existence
|
||||
@@ -363,14 +364,14 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
{
|
||||
Name = "oldpath",
|
||||
ExecutableName = oldpath,
|
||||
FullPath = fullPath,
|
||||
FullPath = linkingTo,
|
||||
};
|
||||
|
||||
Win32Program newitem = new Win32Program
|
||||
{
|
||||
Name = "path",
|
||||
ExecutableName = path,
|
||||
FullPath = fullPath,
|
||||
FullPath = linkingTo,
|
||||
};
|
||||
|
||||
win32ProgramRepository.Add(olditem);
|
||||
|
||||
Reference in New Issue
Block a user