I’m trying to copy files to a user defined folder in the filesystem and I’m getting this error:
I’m getting the destination folder like so, and storing it in a global state object:

This is how I’m calling it:

and my requires look like this:
It all works fine if I set the destination as the “jpegFolder” entry like this:

I’m assuming that this lack of a match is due to the “collateFolder” that’s stored in my global state being retrieved by fs.getFolder() as opposed to getEntry, but I don’t really understand what it means by “storage providers”.
How can I use the user selected folder as the destination for copyTo?
Yesterday I had to deal with storage myself and not done yet (will continue today). Have to say - docs are a mess there… 
I believe storage providers are loacalFileSystem
and secureStorage
(probably localStorage
and sessionStorage
are also considered as providers)
What are your fs
and jpegHighRes
? Could it be they are somehow retrieved by using different providers?
Thanks for the response @Karmalakas, I agree, the docs could really do with some more detail re: storage.
In answer to your question - fs
is uxp.storage.localFileSystem
as defined in my requires, and as is outlined in the docs. jpegHighRes
is an entry that is a subfolder of a persistent token.
Sorry, I won’t be much help here
At least until I play around with storages more myself
1 Like
No worries!
Speaking frankly, storage seems overcomplicated, and is massively counter intuitive (e.g. having to make a session token for a persistent token to save a file)
I resolved this by using fs.createPersistentToken()
instead of fs.getFolder()
.
I half understand the issue - the manner in which you get an entry on the filesystem also defines its storage provider, but beyond that I’m unclear as to the mechanics of it all.
What I find a bit bonkers is that the storage providers can’t work together, or at least that’s how it feels to me at the moment. When I’m no longer on the clock for a client I’ll have a more experimental poke at it.
2 Likes