Talk:IO/B/Filesystem/Level0
From CommonJS Spec Wiki
- you still use OpaqueLeaf. as i mentioned before, Leaf bad term
- all the listXXX functions are odd.
- a) can't list on a file either
- open doesn't make sense on a dir
- 2+3 imply to me that its worht separating into Dir only, File only, and common (Path or Entity)
- isFile isn't always !isDir (fifo,socket, etc)
- should probably have an lstat to go with your stat
- createDir should die if it fails, not return false.
- ditto for anything else that returns false on failure. (setLastModified)
- lastModified returning a date or false is odd od odd. Date or undefined/null, or perhaps even die
Ashb 20:14, 3 October 2009 (UTC)
- couldn't come up with a new name yet
- listXXX are due to open/read/close dir not being portable (Java replaces them with a variety of list functions which can be filtered in different ways).
- a) Course, it errors
- Course, it errors
- The other apis didn't exactly do it... and it's not really a common thing to do. I don't see a reason. Especially since this is level0.
- I know, I debated an isOther, thought !isFile !isDirectory would do, Java doesn't provide this either. I could make a note though.
- stat is lstat; stat and lstat work on file descriptors and paths, an Opaque in that api would be a path, file descriptors don't exist on opaques, file descriptors are used by streams, another stat would require a stat in the stream api.
- Java doesn't throw errors, what about other engines? Throwing an error when a directory you want to exist already exists sounds strange.
- I was avoiding custom errors at this level, this is a low level interface, IMHO not the place for custom errors that are hard to implement in JS engines.
- To match up with other methods
- Daniel Friesen05:25, 4 October 2009 (UTC)