From 8091d0934b8efe96cf7721ec85028b6e4713c271 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 2 Dec 2019 21:58:39 -0500 Subject: [PATCH] 0.9.2 intstaller crash on startup fix --- .../smapiandroidinstaller/ConfigEditorFragment.java | 5 +++++ .../com/MartyrPher/smapiandroidinstaller/MainActivity.java | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/ConfigEditorFragment.java b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/ConfigEditorFragment.java index 0e4eb34..bce128d 100644 --- a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/ConfigEditorFragment.java +++ b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/ConfigEditorFragment.java @@ -85,6 +85,11 @@ public class ConfigEditorFragment extends Fragment { private void getModFiles() { File modFolder = new File(MOD_DIR); + + //Make the directory in case it's not there + if (!modFolder.exists()) + modFolder.mkdir(); + for (File file : modFolder.listFiles()) { recursiveFileCheck(file); diff --git a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java index 392a791..d773b84 100644 --- a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java +++ b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java @@ -49,6 +49,9 @@ public class MainActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.view_pager); + //Request the permissions for storage first. + requestPermissions(); + //Find the ViewPager and TabLayout ids mViewPager = findViewById(R.id.view_pager); mTabLayout = findViewById(R.id.tab_layout); @@ -64,9 +67,6 @@ public class MainActivity extends AppCompatActivity { //Setup the ViewPager adapter and TabLayout with ViewPager mViewPager.setAdapter(mTabAdapter); mTabLayout.setupWithViewPager(mViewPager); - - //Request the permissions for storage access - requestPermissions(); } catch (Exception e) {