summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-12-11 12:45:59 +0000
committerAidan MacDonald <amachronic@protonmail.com>2021-12-24 10:41:27 -0500
commitf4fbc1bcebaca17b251fc8ef8729f317147dd9b0 (patch)
treef886a01f1f8bf311f0e790fc2cf8007258441073
parent6b5c811d1cbd35a492ada36afb2b8d6e59b81a42 (diff)
downloadrockbox-f4fbc1bcebaca17b251fc8ef8729f317147dd9b0.tar.gz
rockbox-f4fbc1bcebaca17b251fc8ef8729f317147dd9b0.zip
tagtree: Support user override config file
Allow users to create an alternative tagnavi config file named "tagnavi_user.config" in the .rockbox directory. If present, it will be used instead of the default tagnavi.config, allowing the default menu to be completely redefined. This makes it much easier to maintain customizations which remove or modify parts of the default config -- since the default config is shipped in the Rockbox zips, a customized tagnavi.config would have to be saved with manual intervention on each & every update. Change-Id: I509177fab0e01fc0db0bc4407a3a92bbff5fa481
-rw-r--r--apps/tagnavi.config8
-rw-r--r--apps/tagtree.c12
2 files changed, 16 insertions, 4 deletions
diff --git a/apps/tagnavi.config b/apps/tagnavi.config
index b9d50c5c9b..74dfb1d1d9 100644
--- a/apps/tagnavi.config
+++ b/apps/tagnavi.config
@@ -2,8 +2,12 @@
2# ^ Version header must be the first line of every file 2# ^ Version header must be the first line of every file
3 3
4# Tag Browser configuration file, do not edit as changes will be lost! 4# Tag Browser configuration file, do not edit as changes will be lost!
5# Instead, you can modify "/.rockbox/tagnavi_custom.config" which will never 5# Instead, copy this file to "/.rockbox/tagnavi_user.config" and edit
6# get overwritten automatically. 6# that, so your changes will not be overwritten automatically.
7#
8# If you only want to add menus and don't need to modify the default
9# ones, you can edit "/.rockbox/tagnavi_custom.config" instead, which
10# is included by this file and will not be overwritten automatically.
7 11
8# Basic format declarations 12# Basic format declarations
9%format "fmt_title" "%s - %02d:%02d (%s)" basename Lm Ls filename ? title == "<Untagged>" 13%format "fmt_title" "%s - %02d:%02d (%s)" basename Lm Ls filename ? title == "<Untagged>"
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 454875ded2..74f0021d6a 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -58,7 +58,8 @@
58 58
59#define str_or_empty(x) (x ? x : "(NULL)") 59#define str_or_empty(x) (x ? x : "(NULL)")
60 60
61#define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" 61#define TAGNAVI_DEFAULT_CONFIG ROCKBOX_DIR "/tagnavi.config"
62#define TAGNAVI_USER_CONFIG ROCKBOX_DIR "/tagnavi_user.config"
62 63
63static int tagtree_play_folder(struct tree_context* c); 64static int tagtree_play_folder(struct tree_context* c);
64 65
@@ -1262,7 +1263,14 @@ void tagtree_init(void)
1262 if (tagtree_handle < 0) 1263 if (tagtree_handle < 0)
1263 panicf("tagtree OOM"); 1264 panicf("tagtree OOM");
1264 1265
1265 if (!parse_menu(FILE_SEARCH_INSTRUCTIONS)) 1266 /* Use the user tagnavi config if present, otherwise use the default. */
1267 const char* tagnavi_file;
1268 if(file_exists(TAGNAVI_USER_CONFIG))
1269 tagnavi_file = TAGNAVI_USER_CONFIG;
1270 else
1271 tagnavi_file = TAGNAVI_DEFAULT_CONFIG;
1272
1273 if (!parse_menu(tagnavi_file))
1266 { 1274 {
1267 tagtree_unload(NULL); 1275 tagtree_unload(NULL);
1268 return; 1276 return;