Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2efc1db6
Commit
2efc1db6
authored
Aug 18, 2022
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android/Environment: no namespace indent
parent
e2d4654e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
25 deletions
+29
-25
Environment.cxx
src/android/Environment.cxx
+12
-10
Environment.hxx
src/android/Environment.hxx
+17
-15
No files found.
src/android/Environment.cxx
View file @
2efc1db6
...
...
@@ -25,13 +25,13 @@
#include "fs/AllocatedPath.hxx"
namespace
Environment
{
static
Java
::
TrivialClass
cls
;
static
jmethodID
getExternalStorageDirectory_method
;
static
jmethodID
getExternalStoragePublic
Directory_method
;
}
static
Java
::
TrivialClass
cls
;
static
jmethodID
getExternalStorage
Directory_method
;
static
jmethodID
getExternalStoragePublicDirectory_method
;
void
Environment
::
Initialise
(
JNIEnv
*
env
)
noexcept
Initialise
(
JNIEnv
*
env
)
noexcept
{
cls
.
Find
(
env
,
"android/os/Environment"
);
...
...
@@ -45,13 +45,13 @@ Environment::Initialise(JNIEnv *env) noexcept
}
void
Environment
::
Deinitialise
(
JNIEnv
*
env
)
noexcept
Deinitialise
(
JNIEnv
*
env
)
noexcept
{
cls
.
Clear
(
env
);
}
AllocatedPath
Environment
::
getExternalStorageDirectory
()
noexcept
getExternalStorageDirectory
()
noexcept
{
JNIEnv
*
env
=
Java
::
GetEnv
();
...
...
@@ -65,7 +65,7 @@ Environment::getExternalStorageDirectory() noexcept
}
AllocatedPath
Environment
::
getExternalStoragePublicDirectory
(
const
char
*
type
)
noexcept
getExternalStoragePublicDirectory
(
const
char
*
type
)
noexcept
{
if
(
getExternalStoragePublicDirectory_method
==
nullptr
)
/* needs API level 8 */
...
...
@@ -74,11 +74,13 @@ Environment::getExternalStoragePublicDirectory(const char *type) noexcept
JNIEnv
*
env
=
Java
::
GetEnv
();
Java
::
String
type2
(
env
,
type
);
jobject
file
=
env
->
CallStaticObjectMethod
(
Environment
::
cls
,
Environment
::
getExternalStoragePublicDirectory_method
,
jobject
file
=
env
->
CallStaticObjectMethod
(
cls
,
getExternalStoragePublicDirectory_method
,
type2
.
Get
());
if
(
file
==
nullptr
)
return
nullptr
;
return
Java
::
File
::
ToAbsolutePath
(
env
,
file
);
}
}
// namespace Environment
src/android/Environment.hxx
View file @
2efc1db6
...
...
@@ -17,27 +17,29 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ANDROID_ENVIRONMENT_HXX
#define MPD_ANDROID_ENVIRONMENT_HXX
#include "util/Compiler.h"
#pragma once
#include <jni.h>
class
AllocatedPath
;
namespace
Environment
{
void
Initialise
(
JNIEnv
*
env
)
noexcept
;
void
Deinitialise
(
JNIEnv
*
env
)
noexcept
;
/**
* Determine the mount point of the external SD card.
*/
[[
gnu
::
pure
]]
AllocatedPath
getExternalStorageDirectory
()
noexcept
;
void
Initialise
(
JNIEnv
*
env
)
noexcept
;
void
Deinitialise
(
JNIEnv
*
env
)
noexcept
;
/**
* Determine the mount point of the external SD card.
*/
[[
gnu
::
pure
]]
AllocatedPath
getExternalStorageDirectory
()
noexcept
;
[[
gnu
::
pure
]]
AllocatedPath
getExternalStoragePublicDirectory
(
const
char
*
type
)
noexcept
;
}
[[
gnu
::
pure
]]
AllocatedPath
getExternalStoragePublicDirectory
(
const
char
*
type
)
noexcept
;
#endif
}
// namespace Environment
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment