Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[droid] Check external storage state before using it

  • Loading branch information...
commit 44e14700130a42eda9bc8904e18fe9e0e058aba0 1 parent 0512600
@mikrohard authored
Showing with 12 additions and 6 deletions.
  1. +12 −6 xbmc/android/activity/XBMCApp.cpp
View
18 xbmc/android/activity/XBMCApp.cpp
@@ -558,12 +558,18 @@ void CXBMCApp::SetupEnv()
setenv("XBMC_HOME", (cacheDir + "/apk/assets").c_str(), 0);
std::string externalDir;
- CJNIFile androidPath = getExternalFilesDir("");
- if (!androidPath)
- androidPath = getDir("org.xbmc.xbmc", 1);
-
- if (androidPath)
- externalDir = androidPath.getAbsolutePath();
+ std::string mountedState = CJNIEnvironment::getExternalStorageState();
+ bool mounted = mountedState == "mounted";
+
+ if (mounted)
+ {
+ CJNIFile androidPath = getExternalFilesDir("");
+ if (!androidPath)
+ androidPath = getDir("org.xbmc.xbmc", 1);
+
+ if (androidPath)
+ externalDir = androidPath.getAbsolutePath();
+ }
if (!externalDir.empty())
setenv("HOME", externalDir.c_str(), 0);
Please sign in to comment.
Something went wrong with that request. Please try again.