mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
Add ability to specify autostart plugin path and argument
Extend AUTOROCK define functionality to allow specifying both the autostart plugin path and its argument. Example: #define AUTOROCK VIEWERS_DATA_DIR "/imageviewer.rock" #define AUTOROCK_ARG "/jpegs/sample.jpg" Change-Id: Icc41bceac676e8db17d3a63baefdf96e3023c181
This commit is contained in:
parent
6f302083b5
commit
5cf3c6bf9a
1 changed files with 16 additions and 5 deletions
21
apps/main.c
21
apps/main.c
|
|
@ -153,7 +153,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif /* SDL */
|
#endif /* SDL */
|
||||||
|
|
||||||
/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
|
// #define AUTOROCK /* define this to check for "autostart.rock" on boot */
|
||||||
|
/* Alternatively, you can define autostart plugin path and its argument: */
|
||||||
|
// #define AUTOROCK VIEWERS_DATA_DIR"/imageviewer.rock"
|
||||||
|
// #define AUTOROCK_ARG "/jpegs/sample.jpg"
|
||||||
|
|
||||||
static void init(void);
|
static void init(void);
|
||||||
/* main(), and various functions called by main() and init() may be
|
/* main(), and various functions called by main() and init() may be
|
||||||
|
|
@ -214,17 +217,25 @@ int main(void)
|
||||||
|
|
||||||
#ifdef AUTOROCK
|
#ifdef AUTOROCK
|
||||||
{
|
{
|
||||||
char filename[MAX_PATH];
|
const char *file = ""AUTOROCK;
|
||||||
const char *file =
|
file = *file
|
||||||
|
? file
|
||||||
|
:
|
||||||
#ifdef APPLICATION
|
#ifdef APPLICATION
|
||||||
ROCKBOX_DIR
|
ROCKBOX_DIR
|
||||||
#else
|
#else
|
||||||
PLUGIN_APPS_DIR
|
PLUGIN_APPS_DIR
|
||||||
#endif
|
#endif
|
||||||
"/autostart.rock";
|
"/autostart.rock";
|
||||||
if(file_exists(file)) /* no complaint if it doesn't exist */
|
if (file_exists(file)) /* no complaint if it doesn't exist */
|
||||||
{
|
{
|
||||||
plugin_load(file, NULL); /* start if it does */
|
plugin_load(file,
|
||||||
|
#ifdef AUTOROCK_ARG
|
||||||
|
AUTOROCK_ARG
|
||||||
|
#else
|
||||||
|
NULL
|
||||||
|
#endif
|
||||||
|
); /* start if it does */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #ifdef AUTOROCK */
|
#endif /* #ifdef AUTOROCK */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue