Lets say I am building an IDE and want to have an option to open recently used folders which also persists after a page refresh. References to FileSystemDirectoryHandle-s, obtained by showDirectoryPicker() are stored in an indexeddb, but real filesystem directory might have been deleted (at some point in time after referencing). What is the proper API to check if it points to an existing directory?
I was thinking of using getDirectoryHandle but I do not have parent reference, nor does it accept empty name argument.
I can try-catch for await (const entry of directory.values()), but this has some downsides (requires permissions granted, consider page refresh) and for that reason its not convinient ux to run through a list of handles (multiple confirms). I wonder if there is something more appropriate.
Lets say I am building an IDE and want to have an option to open recently used folders which also persists after a page refresh. References to FileSystemDirectoryHandle-s, obtained by
showDirectoryPicker()
are stored in an indexeddb, but real filesystem directory might have been deleted (at some point in time after referencing). What is the proper API to check if it points to an existing directory?I was thinking of using
getDirectoryHandle
but I do not have parent reference, nor does it accept empty name argument.I can try-catch
for await (const entry of directory.values())
, but this has some downsides (requires permissions granted, consider page refresh) and for that reason its not convinient ux to run through a list of handles (multiple confirms). I wonder if there is something more appropriate.For the moment I am using