Skip to content

Commit

Permalink
Fix[file_provider]: check for storage before initializing
Browse files Browse the repository at this point in the history
  • Loading branch information
artdeell committed Jan 15, 2025
1 parent 6ed5f7c commit 2275ac5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class FolderProvider extends DocumentsProvider {

private static final String ALL_MIME_TYPES = "*/*";

private static final File BASE_DIR = new File(Tools.DIR_GAME_HOME);
private File BASE_DIR;

private ContentResolver mContentResolver;

Expand Down Expand Up @@ -138,6 +138,12 @@ public AssetFileDescriptor openDocumentThumbnail(String documentId, Point sizeHi

@Override
public boolean onCreate() {
if(Tools.checkStorageRoot(getContext())) {
Tools.initStorageConstants(getContext());
}else {
return false;
}
BASE_DIR = new File(Tools.DIR_GAME_HOME);
mContentResolver = getContext().getContentResolver();
mStorageProviderAuthortiy = getContext().getString(R.string.storageProviderAuthorities);
return true;
Expand Down

0 comments on commit 2275ac5

Please sign in to comment.