When I choose a folder I do get a dirHandle but cannot figure out what property or method will give me the full path
const dirHandle = await window.showDirectoryPicker()
So something like let path = dirHandle.fullpath
Any ideas?
When I choose a folder I do get a dirHandle but cannot figure out what property or method will give me the full path
const dirHandle = await window.showDirectoryPicker()
So something like let path = dirHandle.fullpath
Any ideas?
For security reasons the full path will not be revealed to web applications. You can only learn the relative paths by walking through a directory. In the example below, if the user opens shared/
, you can learn about the existence of ./public
and ./public/file.txt
inside of it, but not that shared/
lies in secret/
and further up.
/root/secret/shared/public/file.txt
showSaveFilePicker()
lives up to the same security standards. –
Therrien © 2022 - 2024 — McMap. All rights reserved.
window.showSaveFilePicker()
I can get the short name of the user-chosen file, but I won't know where it is. – Mcallister