How to access filesystem from panel?
Summary (TL;DR)
Is there any way for the HTML Panel side of an Adobe CEP extension to access the local (Or a LAN's) filesystem?
Long Version
The context
Although I'm fairly experienced with Adobe ExtendScript (AES), having worked with it for more than 5 years now, I'm almost completely brand-new to Adobe CEP. In the last couple of weeks, I've learned quite a bit about it, though.
I have a couple of projects that I wish to convert from a very poorly-made, single-file, procedural, spaghetti-code AES JavaScript file to something more structured and easier to maintain in the future. To that end, I want to use TypeScript and leverage many of its benefits, including modules. Since developing an Adobe CEP extension requires two separate JS environments, I already have my project set up with two tsconfig.json files to handle transpiling to the correct ES versions for each. And since CEP doesn't seem to support CommonJS, I have the HTML Panel side set up to use SystemJS (0.21, as 2.0 has little documentation for newbies so far) in order to facilitate modules. And I'm using TypeScript's namespacing to use external modules on the AES side.
It works, even if it seems a bit kludgey. I can write TypeScript for both sides and have it all transpiled correctly on the fly. External modules work on both sides now, so I can have classes in their own files, etc.
The problem
The first project is a simple one: For Illustrator, list a bunch of .ai files in a local directory recursively (in a <select multiple> element) so the user can filter them with a search box, select the one(s) they want, then click a button to have AI open those files. My issue is trying to get that list of files. It seems that the only way to get a list of files is through Node.js' "fs" function. Well, SystemJS doesn't seem to allow the use of Node.js' core functions. And I cannot find any other way for it to simply grab that list of files in a folder.
As it is, I'll have to set it up so that the panel, upon initializing, calls an AES function to get those files (via Folder(rootFolder).getFiles();) and return them back to the panel via JSON. Then, when the user hits the button to open the files, the panel calls another AES function to actually open them. Is there any way I can avoid that first AES call to have the panel's JS just get the list of files directly, itself?
I apologize for this long-winded question, thus the summary at the beginning. I just felt that it might help give some context to the problem if I explained what I am attempting to accomplish. Feel free to have a look at my project, if you wish, to help you understand a bit more.
