Skip to content

Commit a90fbac

Browse files
authored
Fix: Fixed an issue with creating folder shortcuts (#16040)
1 parent 6e460d4 commit a90fbac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Files.App/Utils/Storage/Operations/FileOperationsHelpers.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,11 @@ public static Task<bool> CreateOrUpdateLinkAsync(string linkSavePath, string tar
740740
if (FileExtensionHelpers.IsShortcutFile(linkSavePath))
741741
{
742742
using var newLink = new ShellLink(targetPath, arguments, workingDirectory);
743-
newLink.RunAsAdministrator = runAsAdmin;
743+
744+
// Check if the target is a file
745+
if (File.Exists(targetPath))
746+
newLink.RunAsAdministrator = runAsAdmin;
747+
744748
newLink.SaveAs(linkSavePath); // Overwrite if exists
745749
return Task.FromResult(true);
746750
}

0 commit comments

Comments
 (0)