本文整理汇总了C++中CJNIFile类的典型用法代码示例。如果您正苦于以下问题:C++ CJNIFile类的具体用法?C++ CJNIFile怎么用?C++ CJNIFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CJNIFile类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool CXBMCApp::GetExternalStorage(std::string &path, const std::string &type /* = "" */)
{
std::string sType;
std::string mountedState;
bool mounted = false;
if(type == "files" || type.empty())
{
CJNIFile external = CJNIEnvironment::getExternalStorageDirectory();
if (external)
path = external.getAbsolutePath();
}
else
{
if (type == "music")
sType = "Music"; // Environment.DIRECTORY_MUSIC
else if (type == "videos")
sType = "Movies"; // Environment.DIRECTORY_MOVIES
else if (type == "pictures")
sType = "Pictures"; // Environment.DIRECTORY_PICTURES
else if (type == "photos")
sType = "DCIM"; // Environment.DIRECTORY_DCIM
else if (type == "downloads")
sType = "Download"; // Environment.DIRECTORY_DOWNLOADS
if (!sType.empty())
{
CJNIFile external = CJNIEnvironment::getExternalStoragePublicDirectory(sType);
if (external)
path = external.getAbsolutePath();
}
}
mountedState = CJNIEnvironment::getExternalStorageState();
mounted = (mountedState == "mounted" || mountedState == "mounted_ro");
return mounted && !path.empty();
}
示例2: setenv
void CXBMCApp::SetupEnv()
{
setenv("XBMC_ANDROID_SYSTEM_LIBS", CJNISystem::getProperty("java.library.path").c_str(), 0);
setenv("XBMC_ANDROID_DATA", getApplicationInfo().dataDir.c_str(), 0);
setenv("XBMC_ANDROID_LIBS", getApplicationInfo().nativeLibraryDir.c_str(), 0);
setenv("XBMC_ANDROID_APK", getPackageResourcePath().c_str(), 0);
std::string cacheDir = getCacheDir().getAbsolutePath();
setenv("XBMC_TEMP", (cacheDir + "/temp").c_str(), 0);
setenv("XBMC_BIN_HOME", (cacheDir + "/apk/assets").c_str(), 0);
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();
if (!externalDir.empty())
setenv("HOME", externalDir.c_str(), 0);
else
setenv("HOME", getenv("XBMC_TEMP"), 0);
}
示例3: setenv
void CXBMCApp::SetupEnv()
{
setenv("KODI_ANDROID_SYSTEM_LIBS", CJNISystem::getProperty("java.library.path").c_str(), 0);
setenv("KODI_ANDROID_LIBS", getApplicationInfo().nativeLibraryDir.c_str(), 0);
setenv("KODI_ANDROID_APK", getPackageResourcePath().c_str(), 0);
std::string appName = CCompileInfo::GetAppName();
StringUtils::ToLower(appName);
std::string className = CCompileInfo::GetPackage();
std::string cacheDir = getCacheDir().getAbsolutePath();
std::string xbmcHome = CJNISystem::getProperty("xbmc.home", "");
if (xbmcHome.empty())
{
setenv("KODI_BIN_HOME", (cacheDir + "/apk/assets").c_str(), 0);
setenv("KODI_HOME", (cacheDir + "/apk/assets").c_str(), 0);
}
else
{
setenv("KODI_BIN_HOME", (xbmcHome + "/assets").c_str(), 0);
setenv("KODI_HOME", (xbmcHome + "/assets").c_str(), 0);
}
setenv("KODI_BINADDON_PATH", (cacheDir + "/lib").c_str(), 0);
std::string externalDir = CJNISystem::getProperty("xbmc.data", "");
if (externalDir.empty())
{
CJNIFile androidPath = getExternalFilesDir("");
if (!androidPath)
androidPath = getDir(className.c_str(), 1);
if (androidPath)
externalDir = androidPath.getAbsolutePath();
}
if (!externalDir.empty())
setenv("HOME", externalDir.c_str(), 0);
else
setenv("HOME", getenv("KODI_TEMP"), 0);
std::string apkPath = getenv("KODI_ANDROID_APK");
apkPath += "/assets/python2.7";
setenv("PYTHONHOME", apkPath.c_str(), 1);
setenv("PYTHONPATH", "", 1);
setenv("PYTHONOPTIMIZE","", 1);
setenv("PYTHONNOUSERSITE", "1", 1);
}