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
14cee01b
Commit
14cee01b
authored
May 29, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main: simplify Android startup
parent
c782fdb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
Main.cxx
src/Main.cxx
+26
-17
No files found.
src/Main.cxx
View file @
14cee01b
...
@@ -455,33 +455,19 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
...
@@ -455,33 +455,19 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
mpd_main_after_fork
(
raw_config
,
config
);
mpd_main_after_fork
(
raw_config
,
config
);
}
}
#ifndef ANDROID
static
inline
void
static
inline
void
MainOrThrow
(
int
argc
,
char
*
argv
[])
MainOrThrow
(
int
argc
,
char
*
argv
[])
{
{
struct
options
options
;
struct
options
options
;
ConfigData
raw_config
;
ConfigData
raw_config
;
#ifdef ANDROID
(
void
)
argc
;
(
void
)
argv
;
const
auto
sdcard
=
Environment
::
getExternalStorageDirectory
();
if
(
!
sdcard
.
IsNull
())
{
const
auto
config_path
=
sdcard
/
Path
::
FromFS
(
"mpd.conf"
);
if
(
FileExists
(
config_path
))
ReadConfigFile
(
raw_config
,
config_path
);
}
#else
ParseCommandLine
(
argc
,
argv
,
options
,
raw_config
);
ParseCommandLine
(
argc
,
argv
,
options
,
raw_config
);
#endif
MainConfigured
(
options
,
raw_config
);
MainConfigured
(
options
,
raw_config
);
}
}
#ifdef ANDROID
static
inline
#endif
int
mpd_main
(
int
argc
,
char
*
argv
[])
noexcept
int
mpd_main
(
int
argc
,
char
*
argv
[])
noexcept
{
{
AtScopeExit
()
{
log_deinit
();
};
AtScopeExit
()
{
log_deinit
();
};
...
@@ -495,6 +481,8 @@ int mpd_main(int argc, char *argv[]) noexcept
...
@@ -495,6 +481,8 @@ int mpd_main(int argc, char *argv[]) noexcept
}
}
}
}
#endif
/* !ANDROID */
static
void
static
void
mpd_main_after_fork
(
const
ConfigData
&
raw_config
,
const
Config
&
config
)
mpd_main_after_fork
(
const
ConfigData
&
raw_config
,
const
Config
&
config
)
{
{
...
@@ -632,6 +620,23 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
...
@@ -632,6 +620,23 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
#ifdef ANDROID
#ifdef ANDROID
static
void
AndroidMain
()
{
struct
options
options
;
ConfigData
raw_config
;
const
auto
sdcard
=
Environment
::
getExternalStorageDirectory
();
if
(
!
sdcard
.
IsNull
())
{
const
auto
config_path
=
sdcard
/
Path
::
FromFS
(
"mpd.conf"
);
if
(
FileExists
(
config_path
))
ReadConfigFile
(
raw_config
,
config_path
);
}
MainConfigured
(
options
,
raw_config
);
}
gcc_visibility_default
gcc_visibility_default
JNIEXPORT
void
JNICALL
JNIEXPORT
void
JNICALL
Java_org_musicpd_Bridge_run
(
JNIEnv
*
env
,
jclass
,
jobject
_context
,
jobject
_logListener
)
Java_org_musicpd_Bridge_run
(
JNIEnv
*
env
,
jclass
,
jobject
_context
,
jobject
_logListener
)
...
@@ -649,7 +654,11 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context, jobject _logL
...
@@ -649,7 +654,11 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context, jobject _logL
logListener
=
new
LogListener
(
env
,
_logListener
);
logListener
=
new
LogListener
(
env
,
_logListener
);
AtScopeExit
()
{
delete
logListener
;
};
AtScopeExit
()
{
delete
logListener
;
};
mpd_main
(
0
,
nullptr
);
try
{
AndroidMain
();
}
catch
(...)
{
LogError
(
std
::
current_exception
());
}
}
}
gcc_visibility_default
gcc_visibility_default
...
...
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