Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[droid] Check external storage state before using it

  • Loading branch information...
commit 44e14700130a42eda9bc8904e18fe9e0e058aba0 1 parent 0512600
Jernej Fijačko authored

Showing 1 changed file with 12 additions and 6 deletions. Show diff stats Hide diff stats

  1. +12 6 xbmc/android/activity/XBMCApp.cpp
18 xbmc/android/activity/XBMCApp.cpp
@@ -558,12 +558,18 @@ void CXBMCApp::SetupEnv()
558 558 setenv("XBMC_HOME", (cacheDir + "/apk/assets").c_str(), 0);
559 559
560 560 std::string externalDir;
561   - CJNIFile androidPath = getExternalFilesDir("");
562   - if (!androidPath)
563   - androidPath = getDir("org.xbmc.xbmc", 1);
564   -
565   - if (androidPath)
566   - externalDir = androidPath.getAbsolutePath();
  561 + std::string mountedState = CJNIEnvironment::getExternalStorageState();
  562 + bool mounted = mountedState == "mounted";
  563 +
  564 + if (mounted)
  565 + {
  566 + CJNIFile androidPath = getExternalFilesDir("");
  567 + if (!androidPath)
  568 + androidPath = getDir("org.xbmc.xbmc", 1);
  569 +
  570 + if (androidPath)
  571 + externalDir = androidPath.getAbsolutePath();
  572 + }
567 573
568 574 if (!externalDir.empty())
569 575 setenv("HOME", externalDir.c_str(), 0);

0 comments on commit 44e1470

Please sign in to comment.
Something went wrong with that request. Please try again.