summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:42:52 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:42:52 +0000
commitfda7d720c05b4a756f045e0c0f4afe9630edb5c5 (patch)
tree35bb19611d47bcb05a49529a73ccc5d66a50476e /apps/plugins/lib
parent5b76936a44de3c7ecd568300f26b5e6421901285 (diff)
downloadrockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.zip
rockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.tar.gz
rockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.tar.bz2
rockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.tar.xz
Accept FS#5464 - organise the rocks directory.
If any plugins or "open with" optoins dont work please let me know... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14214 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/configfile.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c
index 3ca3805..54c067c 100644
--- a/apps/plugins/lib/configfile.c
+++ b/apps/plugins/lib/configfile.c
@@ -26,6 +26,23 @@ void configfile_init(struct plugin_api* newrb)
cfg_rb = newrb;
}
+void get_cfg_filename(char* buf, int buf_len, const char* filename)
+{
+ char *s;
+ cfg_rb->strcpy(buf, cfg_rb->plugin_get_current_filename());
+ s = cfg_rb->strrchr(buf, '/');
+ if (!s) /* should never happen */
+ {
+ cfg_rb->snprintf(buf, buf_len, "/.rockbox/rocks/%s", filename);
+ }
+ else
+ {
+ s++;
+ *s = '\0';
+ cfg_rb->strcat(s, filename);
+ }
+}
+
int configfile_save(const char *filename, struct configdata *cfg,
int num_items, int version)
{
@@ -33,7 +50,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
int i;
char buf[MAX_PATH];
- cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename);
+ get_cfg_filename(buf, MAX_PATH, filename);
fd = cfg_rb->creat(buf);
if(fd < 0)
return fd*10 - 1;
@@ -78,7 +95,7 @@ int configfile_load(const char *filename, struct configdata *cfg,
int file_version = -1;
int tmp;
- cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename);
+ get_cfg_filename(buf, MAX_PATH, filename);
fd = cfg_rb->open(buf, O_RDONLY);
if(fd < 0)
return fd*10 - 1;