[Android] don't load forge.profile.properties when the user is using the obb directory

- until google permits unrestricted access outside the app-specific directory on certain apps via flag, the option to use obb as entrypoint is required since accessing outside the scoped storage is really not recommended (https://issuetracker.google.com/issues?q=scoped%20storage%20slow).
This commit is contained in:
Anthony Calosa
2021-04-27 21:04:51 +08:00
parent 045d7bb5ae
commit 77e56e8da9
4 changed files with 25 additions and 22 deletions

View File

@@ -212,7 +212,7 @@ public final class ForgeConstants {
public static final String DECK_BASE_DIR;
public static final String DECK_CONSTRUCTED_DIR;
static {
ForgeProfileProperties.load();
ForgeProfileProperties.load(GuiBase.isUsingAppDirectory());
USER_DIR = ForgeProfileProperties.getUserDir();
CACHE_DIR = ForgeProfileProperties.getCacheDir();
CACHE_CARD_PICS_DIR = ForgeProfileProperties.getCardPicsDir();

View File

@@ -57,11 +57,11 @@ public class ForgeProfileProperties {
//prevent initializing static class
}
public static void load() {
public static void load(boolean isUsingAppDirectory) {
final Properties props = new Properties();
final File propFile = new File(ForgeConstants.PROFILE_FILE);
try {
if (propFile.canRead()) {
if (propFile.canRead() && !isUsingAppDirectory) {
props.load(new FileInputStream(propFile));
}
} catch (final IOException e) {