1
mirror of https://github.com/revanced/revanced-patches synced 2024-11-19 03:57:27 +01:00

fix(syncforreddit/change-oauth-client-id): use downloads directory

This fixes permission errors on Android
This commit is contained in:
oSumAtrIX 2023-06-12 04:37:44 +02:00
parent e099ae90b0
commit 9b5af77a22
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,9 @@ package android.os;
import java.io.File;
public final class Environment {
public static File getExternalStorageDirectory() {
public static String DIRECTORY_DOWNLOADS = "Download";
public static File getExternalStoragePublicDirectory(final String type) {
throw new UnsupportedOperationException("Stub");
}
}

View File

@ -34,7 +34,10 @@ class ChangeOAuthClientIdPatch : BytecodePatch(
return PatchResultError("No client ID provided")
}
File(Environment.getExternalStorageDirectory(), "reddit_client_id_revanced.txt").also {
File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
"reddit_client_id_revanced.txt"
).also {
if (it.exists()) return@also
val error = """