I’m trying to use Ionic and Capacitor in a Web app that uses Svelte and is bundled with Rollup.
I wanted to test it in the browser, as a Web app. No mobile platform.
After quite a lot of search (the docs don’t focus much on non-mobile development), it seems I got it to work. The flow was much easier than expected-I just had to bundle the Capacitor modules with no further additions, and make a minor fix in the Rollup settings.
I tried @capacitor/device
and it worked (requesting Device.getInfo()
), then I moved to the plugin I was most interested in: @capacitor/filesystem
.
I’m not having success with any of its functions. I tried readdir()
with several paths but I can’t seem to have it work with anything (it always throws on not finding the path), and I cannot understand where paths are pointing to.
I also didn’t understand from the docs whether the directory
field is required or it’s only a iOS/Android thing (again, because the docs assume one is using the functions for mobile).
I tried to write a mock file to the empty path (which is the only one that doesn’t seem to throw) and then have it listed by readdir()
using it with the empty path, but this didn’t work either (so I guess the empty path is not valid or the write fails).
In short, how are paths resolved on Windows and is the filesystem
plugin capable of working somehow when run on a browser on Windows?