You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/10/19 15:33:41 UTC

[GitHub] [cordova-plugin-file] ptorrent opened a new issue, #541: Create file error code 9

ptorrent opened a new issue, #541:
URL: https://github.com/apache/cordova-plugin-file/issues/541

   Hello there,
   
   ### What is expected to happen?
   
   Create a file if not exists... dir.getFIle("test",{"create":true,"exclusive":false}  ) 
   
   ### What does actually happen?
   
   ```
   dir.getFIle("test",{"create":true,"exclusive":false}  ) result on {"code":9} so not created ?
   dir.getFIle("test",{}  ) result on {"code":1} ==> normal
   
   ```
   
   I don't understand the goal of { create exclsuive...}, why it's not working like nodejs ?
   
   ### Version information
   
   Cordova android@10.0.1
   cordova-plugin-file 7.0.0 "File"
   
   Android 12 on my device.
   
   
   


-- 
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-unsubscribe@cordova.apache.org.apache.org

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


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


[GitHub] [cordova-plugin-file] breautek commented on issue #541: Create file error code 9

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #541:
URL: https://github.com/apache/cordova-plugin-file/issues/541#issuecomment-1402876000

   See https://github.com/apache/cordova-plugin-file/issues/527#issuecomment-1402873214


-- 
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-unsubscribe@cordova.apache.org

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


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


[GitHub] [cordova-plugin-file] breautek commented on issue #541: Create file error code 9

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #541:
URL: https://github.com/apache/cordova-plugin-file/issues/541#issuecomment-1357039513

   The following code works for me assuming that my app has ownership of the file (e.g. the file wasn't written by another app)
   
   ```javascript
   document.addEventListener('deviceready', onDeviceReady, false);
   
   var testFiles = async function() {
       window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + 'Download', (downloadsDirEntry) => {
           console.log('DOWNLOADS', downloadsDirEntry);
           downloadsDirEntry.getFile('test1.txt', { create: true }, (fileEntry) => {
               fileEntry.createWriter((writer) => {
                   writer.onwriteend = () => {
                       console.log('file written');
                   };
   
                   writer.onerror = (error) => {
                       console.error('WRITE ERROR', error);
                   };
   
                   writer.write(new Blob(['Hello!'], { type: 'text/plain'}));
               });
           }, (error) => {
               console.error('FILE OPEN', error);
           })
       }, (error) => {
           console.error('DIR READ', error);
       });
   };
   
   function onDeviceReady() {
       // Cordova is now initialized. Have fun!
   
       console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
       document.getElementById('deviceready').classList.add('ready');
   
       testFiles();
   }
   ```
   
   The above code writes the file and can be observed by using `adb pull /storage/emulated/0/Download/test1.txt ./` that both the file exists and contains the contents written.
   
   I don't really know what `exclusive` is used for but it doesn't appear to be required.
   
   Tested against target API 32 / API 32 emulator. Can you please compare, or share some code that reproduces the issue?


-- 
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-unsubscribe@cordova.apache.org

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


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


[GitHub] [cordova-plugin-file] breautek closed issue #541: Create file error code 9

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek closed issue #541: Create file error code 9
URL: https://github.com/apache/cordova-plugin-file/issues/541


-- 
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-unsubscribe@cordova.apache.org

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


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