android/Environment: no namespace indent
This commit is contained in:
src/android
@ -25,13 +25,13 @@
|
|||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
|
|
||||||
namespace Environment {
|
namespace Environment {
|
||||||
static Java::TrivialClass cls;
|
|
||||||
static jmethodID getExternalStorageDirectory_method;
|
static Java::TrivialClass cls;
|
||||||
static jmethodID getExternalStoragePublicDirectory_method;
|
static jmethodID getExternalStorageDirectory_method;
|
||||||
}
|
static jmethodID getExternalStoragePublicDirectory_method;
|
||||||
|
|
||||||
void
|
void
|
||||||
Environment::Initialise(JNIEnv *env) noexcept
|
Initialise(JNIEnv *env) noexcept
|
||||||
{
|
{
|
||||||
cls.Find(env, "android/os/Environment");
|
cls.Find(env, "android/os/Environment");
|
||||||
|
|
||||||
@ -45,13 +45,13 @@ Environment::Initialise(JNIEnv *env) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Environment::Deinitialise(JNIEnv *env) noexcept
|
Deinitialise(JNIEnv *env) noexcept
|
||||||
{
|
{
|
||||||
cls.Clear(env);
|
cls.Clear(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocatedPath
|
AllocatedPath
|
||||||
Environment::getExternalStorageDirectory() noexcept
|
getExternalStorageDirectory() noexcept
|
||||||
{
|
{
|
||||||
JNIEnv *env = Java::GetEnv();
|
JNIEnv *env = Java::GetEnv();
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ Environment::getExternalStorageDirectory() noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
AllocatedPath
|
AllocatedPath
|
||||||
Environment::getExternalStoragePublicDirectory(const char *type) noexcept
|
getExternalStoragePublicDirectory(const char *type) noexcept
|
||||||
{
|
{
|
||||||
if (getExternalStoragePublicDirectory_method == nullptr)
|
if (getExternalStoragePublicDirectory_method == nullptr)
|
||||||
/* needs API level 8 */
|
/* needs API level 8 */
|
||||||
@ -74,11 +74,13 @@ Environment::getExternalStoragePublicDirectory(const char *type) noexcept
|
|||||||
JNIEnv *env = Java::GetEnv();
|
JNIEnv *env = Java::GetEnv();
|
||||||
|
|
||||||
Java::String type2(env, type);
|
Java::String type2(env, type);
|
||||||
jobject file = env->CallStaticObjectMethod(Environment::cls,
|
jobject file = env->CallStaticObjectMethod(cls,
|
||||||
Environment::getExternalStoragePublicDirectory_method,
|
getExternalStoragePublicDirectory_method,
|
||||||
type2.Get());
|
type2.Get());
|
||||||
if (file == nullptr)
|
if (file == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return Java::File::ToAbsolutePath(env, file);
|
return Java::File::ToAbsolutePath(env, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Environment
|
||||||
|
@ -17,27 +17,29 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MPD_ANDROID_ENVIRONMENT_HXX
|
#pragma once
|
||||||
#define MPD_ANDROID_ENVIRONMENT_HXX
|
|
||||||
|
|
||||||
#include "util/Compiler.h"
|
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
class AllocatedPath;
|
class AllocatedPath;
|
||||||
|
|
||||||
namespace Environment {
|
namespace Environment {
|
||||||
void Initialise(JNIEnv *env) noexcept;
|
|
||||||
void Deinitialise(JNIEnv *env) noexcept;
|
|
||||||
|
|
||||||
/**
|
void
|
||||||
* Determine the mount point of the external SD card.
|
Initialise(JNIEnv *env) noexcept;
|
||||||
*/
|
|
||||||
[[gnu::pure]]
|
|
||||||
AllocatedPath getExternalStorageDirectory() noexcept;
|
|
||||||
|
|
||||||
[[gnu::pure]]
|
void
|
||||||
AllocatedPath getExternalStoragePublicDirectory(const char *type) noexcept;
|
Deinitialise(JNIEnv *env) noexcept;
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
/**
|
||||||
|
* Determine the mount point of the external SD card.
|
||||||
|
*/
|
||||||
|
[[gnu::pure]]
|
||||||
|
AllocatedPath
|
||||||
|
getExternalStorageDirectory() noexcept;
|
||||||
|
|
||||||
|
[[gnu::pure]]
|
||||||
|
AllocatedPath
|
||||||
|
getExternalStoragePublicDirectory(const char *type) noexcept;
|
||||||
|
|
||||||
|
} // namespace Environment
|
||||||
|
Reference in New Issue
Block a user