peterfox1 edited a comment on issue #408:
URL:
https://github.com/apache/cordova-plugin-file/issues/408#issuecomment-666302030
Gave it a go saving to another location to see if it would get around that
permission, seems like saving to the app data directory
`cordova.file.dataDirectory` works.
`fileSystem.root` seems to be outside of the app data perhaps? - I didn't
realise this since the docs say "fs.root is a DirectoryEntry object that
represents the persistent storage in the sandboxed file system."
Also noticed the following when trying out some options:
- If the file was created by the API 28 app, the API 29 app seems to be able
to write to it, it just can't create new files.
- Using `requestFileSystem(window.TEMPORARY` seems to work.
In case it's useful for anyone else that only needs to store files in the
app dir, the change to use `cordova.file.dataDirectory` is:
```js
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, // <-----------
function (dirEntry) { // <-----------
dirEntry.getFile("test2.txt", {create: true, exclusive: false},
// <-----------
function(fileEntry) { // File loaded/created
fileEntry.createWriter(
function(writer) { // Writer
created
writer.write('hello');
console.log('test2 it worked!');
},
function(error) { // Writer
failure
console.log('createWriter',
error);
}
);
},
function(error) { // File failure
console.log('getFile', error);
}
);
},
function(error) { console.log('resolveLocalFileSystemURL', error); }
);
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]