Closed MrOtherGuy closed 11 months ago
The new filesystem API is now live. I preserved the old helpers for backwards compatibility for now, they should have the same behavior as before although now they are just wrappers for underlying fs.
methods.
I've added a version number for this build 0.7
and the plan is that those compatibility wrappers will be removed with the version in which the loader module is transformed to ES6 module. That will happen along with Firefox ESR 115 later this year.
This can be closed because old methods have been removed.
This is something that's been bothering me for a while. The old methods to interact with filesystem are really all over the place. It would be great to have a totally separate filesystem namespace where all filesystem stuff can live.
But replacing the old ways is going to be a breaking change. The loader itself interacts with various filesystem related functions too so it's going to be a pretty big change. The new interface could look like this:
The FileSystemResult object is basically a wrapper - a common interface which represents one of:
To get the actual data out of this you would use one of few methods:
In essence, the operations that can be given a String (a filename) would produce FileSystemResult objects, but methods on those will produce native data be it content or nsIFile or throw an exception.
However, it's debatable if Error should be one variant or is it better to just throw an error. Perhaps non-existent file should produce a variant but other kind of "errors" should throw?