Reputation: 607
I am creating a script for Chrome browser to handle files (using File System Access API
). This is totally fine on Windows, but on MAC I have this issue:
The files are stored in folders which look like files on MAC. For example folder name is thisisfolder.xyz
and inside there are files like file.xml
.
thisisfolder.xyz
file.xml
file2.xml
...
If I choose directory handler (handle.getDirectoryHandle(someDirectory)
), those folders (thisisfolder.xyz
) are greyed out and can't be selected. If I choose file handler (handle.getFileHandle(someDirectories)
), I can select thisisfolder.xyz
and similar, but later when I want to access files in this folder, I can't, because API thinks those folders are files.
var subdirHandle = await handle.getDirectoryHandle(someDirectory);
for await (var [name, entry] of subdirHandle.entries()) {
...
}
Do I have any possibility here?
Upvotes: 0
Views: 468
Reputation: 2514
This is working as intended. If you try to create a folder named test.txt
on a Mac, the Finder even helpfully warns you about the issue you are experiencing:
Are you sure you want to add the extensions ".txt" to the end of the name? If you make this change, your folder may appear as a single file.
Upvotes: 1