Start using fill_pathname_application_directory

This commit is contained in:
twinaphex 2016-06-11 19:37:16 +02:00
parent 6989d60cdc
commit 78904911ca
3 changed files with 30 additions and 21 deletions

View File

@ -269,6 +269,20 @@ void fill_pathname_application_directory(char *s, size_t len, enum application_d
{ {
switch (type) switch (type)
{ {
case APPLICATION_DIRECTORY_ASSETS_XMB_ICONS:
#ifdef HAVE_XMB
{
char s1[PATH_MAX_LENGTH] = {0};
char s2[PATH_MAX_LENGTH] = {0};
fill_pathname_application_directory(s1, sizeof(s1),
APPLICATION_DIRECTORY_ASSETS_XMB);
fill_pathname_join(s2, s1, "png",
sizeof(s2));
fill_pathname_slash(s2, sizeof(s2));
strlcpy(s, s2, len);
}
#endif
break;
case APPLICATION_DIRECTORY_ASSETS_XMB: case APPLICATION_DIRECTORY_ASSETS_XMB:
#ifdef HAVE_XMB #ifdef HAVE_XMB
{ {

View File

@ -25,7 +25,8 @@
enum application_directory enum application_directory
{ {
APPLICATION_DIRECTORY_NONE = 0, APPLICATION_DIRECTORY_NONE = 0,
APPLICATION_DIRECTORY_ASSETS_XMB APPLICATION_DIRECTORY_ASSETS_XMB,
APPLICATION_DIRECTORY_ASSETS_XMB_ICONS
}; };
bool fill_pathname_application_data(char *s, size_t len); bool fill_pathname_application_data(char *s, size_t len);

View File

@ -194,7 +194,6 @@ typedef struct xmb_handle
float vertical; float vertical;
} spacing; } spacing;
char dir[4];
int size; int size;
} icon; } icon;
@ -387,22 +386,19 @@ static float *xmb_gradient_ident(void)
static void xmb_fill_default_background_path(xmb_handle_t *xmb, static void xmb_fill_default_background_path(xmb_handle_t *xmb,
char *path, size_t size) char *path, size_t size)
{ {
char themepath[PATH_MAX_LENGTH] = {0}; char themepath[PATH_MAX_LENGTH] = {0};
char iconpath[PATH_MAX_LENGTH] = {0}; char iconpath[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
strlcpy(xmb->icon.dir, "png", sizeof(xmb->icon.dir)); fill_pathname_application_directory(themepath, sizeof(themepath),
APPLICATION_DIRECTORY_ASSETS_XMB);
fill_pathname_application_directory(iconpath, sizeof(iconpath),
APPLICATION_DIRECTORY_ASSETS_XMB_ICONS);
fill_pathname_application_directory(themepath, sizeof(themepath), fill_pathname_join(path, iconpath, "bg.png", size);
APPLICATION_DIRECTORY_ASSETS_XMB);
fill_pathname_join(iconpath, themepath, xmb->icon.dir, sizeof(iconpath)); if (*settings->path.menu_wallpaper)
fill_pathname_slash(iconpath, sizeof(iconpath)); strlcpy(path, settings->path.menu_wallpaper, size);
fill_pathname_join(path, iconpath, "bg.png", size);
if (*settings->path.menu_wallpaper)
strlcpy(path, settings->path.menu_wallpaper, size);
} }
static size_t xmb_list_get_selection(void *data) static size_t xmb_list_get_selection(void *data)
@ -1376,9 +1372,8 @@ static void xmb_context_reset_horizontal_list(
strlcpy(sysname, path, sizeof(sysname)); strlcpy(sysname, path, sizeof(sysname));
path_remove_extension(sysname); path_remove_extension(sysname);
fill_pathname_join(iconpath, themepath, xmb->icon.dir, fill_pathname_application_directory(iconpath, sizeof(iconpath),
sizeof(iconpath)); APPLICATION_DIRECTORY_ASSETS_XMB_ICONS);
fill_pathname_slash(iconpath, sizeof(iconpath));
fill_pathname_join(texturepath, iconpath, sysname, fill_pathname_join(texturepath, iconpath, sysname,
sizeof(texturepath)); sizeof(texturepath));
@ -2803,14 +2798,13 @@ static void xmb_context_reset(void *data)
if (!xmb) if (!xmb)
return; return;
strlcpy(xmb->icon.dir, "png", sizeof(xmb->icon.dir));
xmb_fill_default_background_path(xmb, xmb_fill_default_background_path(xmb,
xmb->background_file_path, sizeof(xmb->background_file_path)); xmb->background_file_path, sizeof(xmb->background_file_path));
fill_pathname_application_directory(themepath, sizeof(themepath), fill_pathname_application_directory(themepath, sizeof(themepath),
APPLICATION_DIRECTORY_ASSETS_XMB); APPLICATION_DIRECTORY_ASSETS_XMB);
fill_pathname_join(iconpath, themepath, xmb->icon.dir, sizeof(iconpath)); fill_pathname_application_directory(iconpath, sizeof(iconpath),
fill_pathname_slash(iconpath, sizeof(iconpath)); APPLICATION_DIRECTORY_ASSETS_XMB_ICONS);
xmb_layout(xmb); xmb_layout(xmb);
xmb_font(xmb); xmb_font(xmb);