Re: [w3c/FileAPI] Fold File and Directory Entries API into File API (PR #222)

@marcoscaceres commented on this pull request.



> @@ -75,6 +78,9 @@ spec: ecma-262; urlPrefix: http://tc39.github.io/ecma262/
   type: interface
     text: Array; url: sec-array-constructor
     text: Date; url: sec-date-constructor
+  type: dfn

Nit: it's weird that we need this here... bikeshed should have found it on its own, but I might be wrong. Might be worth a quick check with removing it. 

> @@ -260,6 +266,179 @@ up to but not including the <var>end</var> parameter. It must act as follows:
 
 </div>
 
+## Names and paths ## {#names-paths}
+
+A <dfn export>name</dfn> is a string which:

Maybe... just exporting "name" is too generic: 
```suggestion
A <dfn export local-lt="name">file name</dfn> is a [=string=] which:
```


> @@ -260,6 +266,179 @@ up to but not including the <var>end</var> parameter. It must act as follows:
 
 </div>
 
+## Names and paths ## {#names-paths}
+
+A <dfn export>name</dfn> is a string which:
+
+  * does not contain '/' (U+002F SOLIDUS)
+  * does not contain NUL (U+0000)
+  * does not contain '\' (U+005C REVERSE SOLIDUS)
+  * is not '.' (U+002E FULL STOP)
+  * is not '..' (U+002E FULL STOP, U+002E FULL STOP)
+
+A <dfn export>path segment</dfn> is a [=/name=], '.' (U+002E FULL STOP) or

@annevk, could use your opinion here... should we just do this kind of export, or do you think it might be better to `a path's <dfn for=path export>segment</dfn>`? 

Same with the ones below... 

I'm also worried about collisions with https://url.spec.whatwg.org/#relative-url-string and friends, so want to make sure this is ok.

> +A <dfn export>relative path</dfn> is a string consisting of one or more
+[=path segments=] joined by '/' (U+002F SOLIDUS) that does not start
+with '/' (U+002F SOLIDUS).
+
+An <dfn export>absolute path</dfn> is a string consisting of '/' (U+002F
+SOLIDUS) followed by zero or more [=path segments=] joined by '/'
+(U+002F SOLIDUS).
+
+A <dfn export>path</dfn> is either a [=relative path=] or an [=absolute
+path=].
+
+A <dfn export>valid path</dfn> is a {{USVString}} which is a [=path=].
+
+## Files and directories ## {#files-dirs}
+
+A <dfn export id=file-concept>file</dfn> consists of binary data and a <dfn

How come this one needs an id and the others don't? 

> +A <dfn export id=file-concept>file</dfn> consists of binary data and a <dfn
+for=file>name</dfn> (a non-empty [=/name=]).
+
+A <dfn export>directory</dfn> consists of a <dfn for=directory>name</dfn> (a
+[=/name=]) and an ordered list of members. Each member is either a
+[=file=] or a [=/directory=]. Each member of a [=/directory=] must have
+a distinct non-empty [=/name=].
+
+A <dfn export>root directory</dfn> is a [=/directory=] that is not a member of
+a [=/directory=]. A [=root directory=]'s [=/name=] is empty.
+
+The <dfn export>parent</dfn> of a [=file=] or [=/directory=] is the
+[=/directory=] it is a member of. A [=root directory=] has no
+[=parent=].
+
+Issue: Should [=/directory=] be defined as a special type of [=file=]

Do we have a bug filed for this we could point to here? 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/pull/222#pullrequestreview-4719163091
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/FileAPI/pull/222/review/4719163091@github.com>

Received on Saturday, 18 July 2026 05:30:22 UTC