Fix deletable flags in DocumentProvider

A file is deletable if the _parent_ is writable, not the file itself.
This commit is contained in:
x0b 2020-02-06 16:48:44 +01:00 committed by Fredrik Fornwall
parent ed9afa082a
commit 5d06f040e8
1 changed files with 3 additions and 2 deletions

View File

@ -248,10 +248,11 @@ public class TermuxDocumentsProvider extends DocumentsProvider {
int flags = 0;
if (file.isDirectory()) {
if (file.isDirectory() && file.canWrite()) flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
if (file.canWrite()) flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
} else if (file.canWrite()) {
flags |= Document.FLAG_SUPPORTS_WRITE | Document.FLAG_SUPPORTS_DELETE;
flags |= Document.FLAG_SUPPORTS_WRITE;
}
if (file.getParentFile().canWrite()) flags |= Document.FLAG_SUPPORTS_DELETE;
final String displayName = file.getName();
final String mimeType = getMimeType(file);