From 9c0b2479f7025a84444adf08e3be8ced60dad013 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 1 Aug 2010 16:15:27 +0000 Subject: Rockbox as an application: add get_user_file_path(). For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox). This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local. On the DAPs it's a no-op, returing /.rockbox directly. Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_fonts.c | 2 +- apps/gui/skin_engine/skin_parser.c | 3 ++- apps/gui/theme_settings.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/skin_engine/skin_fonts.c b/apps/gui/skin_engine/skin_fonts.c index 92a6a22ccf..b3b4df2c92 100644 --- a/apps/gui/skin_engine/skin_fonts.c +++ b/apps/gui/skin_engine/skin_fonts.c @@ -100,7 +100,7 @@ int skin_font_load(char* font_name) pf->buffer_size = SKIN_FONT_SIZE; snprintf(filename, MAX_PATH, FONT_DIR "/%s.fnt", font_name); - strcpy(font->name, font_name); + get_user_file_path(filename, FORCE_BUFFER_COPY, font->name, sizeof(font->name)); pf->fd = -1; font->font_id = font_load(pf, filename); diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index e5c89ab2b1..d0194c669b 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1452,7 +1452,8 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, strlcpy(bmpdir, buf, dot - buf + 1); } else - { + { /* fall back to backdrop dir for built-in themes */ + /* no get_user_file_path(), assuming we ship bmps for built-in themes */ snprintf(bmpdir, MAX_PATH, "%s", BACKDROP_DIR); } /* load the bitmaps that were found by the parsing */ diff --git a/apps/gui/theme_settings.c b/apps/gui/theme_settings.c index e9862eda3a..a975c218cd 100644 --- a/apps/gui/theme_settings.c +++ b/apps/gui/theme_settings.c @@ -97,7 +97,9 @@ void settings_apply_skins(void) CHART2(">skin load ", skins[i].suffix); if (skins[i].setting[0] && skins[i].setting[0] != '-') { - snprintf(buf, sizeof buf, WPS_DIR "/%s.%s", + char path[MAX_PATH]; + snprintf(buf, sizeof buf, "%s/%s.%s", + get_user_file_path(WPS_DIR, false, path, sizeof(path)), skins[i].setting, skins[i].suffix); skins[i].loadfunc(screen, buf, true); } -- cgit v1.2.3