KristofferStrube / Blazor.FileSystemAccess

A Blazor wrapper for the File System Access browser API.
https://kristofferstrube.github.io/Blazor.FileSystemAccess/
MIT License
327 stars 39 forks source link

Question: Is it possible to get a directory handle without using the directory picker? #44

Closed mhsimkin closed 1 year ago

mhsimkin commented 1 year ago

Hi:

I know the path to the directory that I need to open to look for a file. Is there anyway to get a directory handle without using the directory picker? For example: C:/Users/Public/AccountPictures/[SID].

If I know the path to a file, but the name will have a wildcard, would it be possible to open the file? All the files at the above path will have are names as [GUID]-Image[size], where the GUID would be the same for all the files in the directory. I need to get access to [GUID]-Image96.jpg and [GUID]-Image64.jpg.

The full file path would be: C:/Users/Public/AccountPictures/[SID]/[GUID]-Image[size].jpg,

This is the location where the avatar images used on the Windows Logon Screen, Outlook, Teams, etc are stored.

Thanks

-marc

KristofferStrube commented 1 year ago

Hey @mhsimkin,

Without opening the file or directory picker, you can't access files or directories using the File System Access API. The reason why you can't do this is because it would be a security risk.

I hope you find some other solution for your project, though. 😊

mhsimkin commented 1 year ago

Thanks. That is what I figured.

mhsimkin commented 1 year ago

One other question. How can I open the file picker in a folder that is not well known? Thanks.

KristofferStrube commented 1 year ago

Hey @mhsimkin there is an overload for all the file/directory dialog methods without the extra option which you can use if you have no preferences.