[whatwg] Drag-and-drop folders/files support with directory structure using DirectoryEntry

Glenn Maynard glenn at zewt.org
Wed Nov 16 16:32:01 PST 2011


On Wed, Nov 16, 2011 at 6:55 PM, Daniel Cheng <dcheng at chromium.org> wrote:

> I see. I personally feel it's a little confusing to have two different
> ways to read files in DataTransfer, and now we're adding a third.
>

I don't think that's a good reason not to support this, but that said, it
may be possible to integrate this with DataTransferItem.  Add a third
DataTransferItem kind, "directory" (in addition to "file" and "string"),
whose "drag data item kind" is DirectoryEntry.  Individual files would
continue to be exposed as File.

The main disadvantage (aside from the inconsistency of not using Entry
subclasses for both) is the writable case, where you really do need
FileEntry rather than File.  I'm not sure how interesting the
writable-single-file case is, since there's no way to perform "safe" writes
(you can't create a file next to it, to perform atomic overwrites), and it
only works for modifying existing files (you can't drag in a nonexistant
file).  So, maybe that's not important.

-- 
Glenn Maynard



More information about the whatwg mailing list