Skip to content

Commit

Permalink
fix(syncforreddit/change-oauth-client-id): use downloads directory
Browse files Browse the repository at this point in the history
This fixes permission errors on Android
  • Loading branch information
oSumAtrIX committed Jun 12, 2023
1 parent e099ae9 commit 9b5af77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dummy/src/main/java/android/os/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down

0 comments on commit 9b5af77

Please sign in to comment.