Provide a context sensitive default file name when saving settings (FS#10399)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21589 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Alexander Levin 2009-07-01 11:21:59 +00:00
parent a85f3695ef
commit 7398c2d20d

View file

@ -620,27 +620,35 @@ int settings_save(void)
bool settings_save_config(int options) bool settings_save_config(int options)
{ {
char filename[MAX_PATH]; char filename[MAX_PATH];
char *folder; char *folder, *namebase;
switch (options) switch (options)
{ {
case SETTINGS_SAVE_THEME: case SETTINGS_SAVE_THEME:
folder = THEME_DIR; folder = THEME_DIR;
namebase = "theme";
break; break;
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
case SETTINGS_SAVE_RECPRESETS: case SETTINGS_SAVE_RECPRESETS:
folder = RECPRESETS_DIR; folder = RECPRESETS_DIR;
namebase = "recording";
break; break;
#endif #endif
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
case SETTINGS_SAVE_EQPRESET: case SETTINGS_SAVE_EQPRESET:
folder = EQS_DIR; folder = EQS_DIR;
namebase = "eq";
break; break;
#endif #endif
case SETTINGS_SAVE_SOUND: case SETTINGS_SAVE_SOUND:
folder = ROCKBOX_DIR;
namebase = "sound";
break;
default: default:
folder = ROCKBOX_DIR; folder = ROCKBOX_DIR;
namebase = "config";
break;
} }
create_numbered_filename(filename, folder, "config", ".cfg", 2 create_numbered_filename(filename, folder, namebase, ".cfg", 2
IF_CNFN_NUM_(, NULL)); IF_CNFN_NUM_(, NULL));
/* allow user to modify filename */ /* allow user to modify filename */