StorageFile should support representing shortcut files
Today StorageFile doesn't support shortcut file (ones with .lnk, .url or .wsh) and invoking any method throws an exception. Please let StorageFile represent shortcut files. Another thing is in File Explorer, the Share option for shortcut files is greyed out. It would be better if it shared the actual URI or file that the shortcut file instead of not allowing the option to share at all.
@Jaiganeshkumaran StorageFile does support representing shortcut files. You can test this by dragging any shortcut files from explorer to a XAML app and it would be detected as a StorageFile. The only issue I can test is you can't get StorageFile object from StorageFile.GetFileFromPathAsync (or any StorageFile API that uses name to retrieve file) if the path points to a shortcut. Is there any other api that fails for you?
Part Of:
- #8.
Hi @jaigak, thanks for raising this topic. We’ve introduced the new Microsoft.Windows.Storage.Pickers APIs - feel free to take a look when you have a moment:
FileOpenPicker.FileTypeFilter Property
The new pickers can pick .lnk path by specifying .lnk among the FileTypeFilter:
var pk = new FileOpenPicker(default) // if in an app window, use `new FileOpenPicker(this.AppWindow.Id)`
{
FileTypeFilter = { ".lnk", "*" },
};
var res = await pk.PickSingleFileAsync();
Console.WriteLine($"Picked file: {res?.Path ?? "No file picked"}");