I'm using window.resolveLocalFileSystemURL() to get a directory entry.
I need to know if this directory exists to delete it before proceeding.
When doing...
const path = cordova.file.dataDirectory + directoryName;
window.resolveLocalFileSystemURL(path, (directoryEntry) => {
console.log(directoryEntry);
});
... I get a DirectoryEntry object, but other than an empty name there doesn't seem to be a way to check whether it exists or not.
This is the only DirectoryEntry available documentation but it's seriously outdated:
https://cordova.apache.org/docs/en/2.4.0/cordova/file/directoryentry/directoryentry.html
The current docs of the File plugin don't have much information on DirectoryEntry:
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/index.html
So how can I know if a directory exists using Cordova?