1
0
Fork 0
forked from len0rd/rockbox

[BugFix] pitch screen load config fd wasn't closed

check file_exist(PITCH_CFG_FILE)
close fd when finished

If you already have a setting saved and you reenter the pitch plugin
with differing pitch settings you will be asked to restore your
default settings

update manual entry to be a clearer

Change-Id: Iaaaf08983a355f9848412d1c6b0bba25d6ea8f39
This commit is contained in:
William Wilgus 2025-01-18 11:08:13 -05:00
parent a8f6ddc5ed
commit c4ceea40bf
4 changed files with 49 additions and 31 deletions

View file

@ -23,6 +23,13 @@
static void get_cfg_filename(char* buf, int buf_len, const char* filename)
{
if (rb->strncmp(filename, ROCKBOX_DIR, sizeof(ROCKBOX_DIR) - 1) == 0)
{
/* allow the rockbox directory */
rb->snprintf(buf, buf_len, "/%s", filename);
return;
}
#ifdef APPLICATION
rb->snprintf(buf, buf_len, PLUGIN_DATA_DIR "/%s", filename);
#else
@ -49,14 +56,8 @@ int configfile_save(const char *filename, const struct configdata *cfg,
int i;
char buf[MAX_PATH];
if (rb->strncmp(filename, ROCKBOX_DIR, sizeof(ROCKBOX_DIR) - 1) != 0)
{
get_cfg_filename(buf, MAX_PATH, filename);
fd = rb->creat(buf, 0666);
}
else /* allow saving to the rockbox directory */
fd = rb->creat(filename, 0666);
get_cfg_filename(buf, MAX_PATH, filename);
fd = rb->creat(buf, 0666);
if(fd < 0)
return fd*10 - 1;