breautek commented on issue #376:
URL: 
https://github.com/apache/cordova-plugin-file-transfer/issues/376#issuecomment-2125343632

   I don't think recursive directory creates are supported.
   
   e.g. you must first check if `images` is created and if not, create the 
directory, then check for `profile` directory and create it if it doesn't exist.
   
   Directly attempting to create (or get) `images/profile` will fail if 
`images` is not already created. Likewise, attempting to download to a 
directory whose path isn't available will also fail. This is noted 
[here](https://github.com/apache/cordova-plugin-file?tab=readme-ov-file#create-directories-)
   
   In otherwords:
   
   ```
   entry.getDirectory("images/profile", {
                   create: true
               }, onGetDirectorySuccess, onGetDirectoryFail);
   ```
   
   this is unsafe unless `images` directory is guaranteed to exist which is an 
unsafe assumption for `applicationStorageDirectory` directory. It needs to be 
split into 2 getDirectory calls, cascaded into their respective callbacks.
   
   ```
   entry.getDirectory("images", {
     create: true
   }, (imagesDir) => {
     imagesDir.getDirectory("profile", {
       create: true
     }, onGetDirectorySuccess, onGetDirectoryFail);
   }, onGetDirectoryFail);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to