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
1f4df2a6
Commit
1f4df2a6
authored
Aug 18, 2022
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android/Environment: pass JNIEnv to all functions
parent
2efc1db6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
12 deletions
+9
-12
Main.cxx
src/Main.cxx
+3
-3
Environment.cxx
src/android/Environment.cxx
+2
-6
Environment.hxx
src/android/Environment.hxx
+2
-2
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+2
-1
No files found.
src/Main.cxx
View file @
1f4df2a6
...
...
@@ -591,12 +591,12 @@ MainConfigured(const CommandLineOptions &options,
#ifdef ANDROID
static
void
AndroidMain
()
AndroidMain
(
JNIEnv
*
env
)
{
CommandLineOptions
options
;
ConfigData
raw_config
;
const
auto
sdcard
=
Environment
::
getExternalStorageDirectory
();
const
auto
sdcard
=
Environment
::
getExternalStorageDirectory
(
env
);
if
(
!
sdcard
.
IsNull
())
{
const
auto
config_path
=
sdcard
/
Path
::
FromFS
(
"mpd.conf"
);
...
...
@@ -625,7 +625,7 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context, jobject _logL
AtScopeExit
()
{
delete
logListener
;
};
try
{
AndroidMain
();
AndroidMain
(
env
);
}
catch
(...)
{
LogError
(
std
::
current_exception
());
}
...
...
src/android/Environment.cxx
View file @
1f4df2a6
...
...
@@ -51,10 +51,8 @@ Deinitialise(JNIEnv *env) noexcept
}
AllocatedPath
getExternalStorageDirectory
()
noexcept
getExternalStorageDirectory
(
JNIEnv
*
env
)
noexcept
{
JNIEnv
*
env
=
Java
::
GetEnv
();
jobject
file
=
env
->
CallStaticObjectMethod
(
cls
,
getExternalStorageDirectory_method
);
...
...
@@ -65,14 +63,12 @@ getExternalStorageDirectory() noexcept
}
AllocatedPath
getExternalStoragePublicDirectory
(
const
char
*
type
)
noexcept
getExternalStoragePublicDirectory
(
JNIEnv
*
env
,
const
char
*
type
)
noexcept
{
if
(
getExternalStoragePublicDirectory_method
==
nullptr
)
/* needs API level 8 */
return
nullptr
;
JNIEnv
*
env
=
Java
::
GetEnv
();
Java
::
String
type2
(
env
,
type
);
jobject
file
=
env
->
CallStaticObjectMethod
(
cls
,
getExternalStoragePublicDirectory_method
,
...
...
src/android/Environment.hxx
View file @
1f4df2a6
...
...
@@ -36,10 +36,10 @@ Deinitialise(JNIEnv *env) noexcept;
*/
[[
gnu
::
pure
]]
AllocatedPath
getExternalStorageDirectory
()
noexcept
;
getExternalStorageDirectory
(
JNIEnv
*
env
)
noexcept
;
[[
gnu
::
pure
]]
AllocatedPath
getExternalStoragePublicDirectory
(
const
char
*
type
)
noexcept
;
getExternalStoragePublicDirectory
(
JNIEnv
*
env
,
const
char
*
type
)
noexcept
;
}
// namespace Environment
src/fs/StandardDirectory.cxx
View file @
1f4df2a6
...
...
@@ -254,7 +254,8 @@ GetUserMusicDir() noexcept
#elif defined(USE_XDG)
return
GetUserDir
(
"XDG_MUSIC_DIR"
);
#elif defined(ANDROID)
return
Environment
::
getExternalStoragePublicDirectory
(
"Music"
);
return
Environment
::
getExternalStoragePublicDirectory
(
Java
::
GetEnv
(),
"Music"
);
#else
return
nullptr
;
#endif
...
...
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