Settings cleanups

This commit is contained in:
twinaphex 2020-03-05 01:03:55 +01:00
parent 2333b7f31a
commit 09f595e0a8

View File

@ -146,21 +146,21 @@ void fill_pathname_application_special(char *s,
{
case APPLICATION_SPECIAL_DIRECTORY_AUTOCONFIG:
{
settings_t *settings = config_get_ptr();
fill_pathname_join(s,
settings->paths.directory_autoconfig,
settings->arrays.input_joypad_driver,
len);
settings_t *settings = config_get_ptr();
const char *dir_autoconfig = settings->paths.directory_autoconfig;
const char *joypad_driver = settings->arrays.input_joypad_driver;
fill_pathname_join(s, dir_autoconfig, joypad_driver, len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_CONFIG:
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const char *dir_menu_config = settings->paths.directory_menu_config;
/* Try config directory setting first,
* fallback to the location of the current configuration file. */
if (!string_is_empty(settings->paths.directory_menu_config))
strlcpy(s, settings->paths.directory_menu_config, len);
if (!string_is_empty(dir_menu_config))
strlcpy(s, dir_menu_config, len);
else if (!path_is_empty(RARCH_PATH_CONFIG))
fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
}
@ -192,10 +192,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG:
#ifdef HAVE_XMB
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const char *path_menu_wallpaper = settings->paths.path_menu_wallpaper;
if (!string_is_empty(settings->paths.path_menu_wallpaper))
strlcpy(s, settings->paths.path_menu_wallpaper, len);
if (!string_is_empty(path_menu_wallpaper))
strlcpy(s, path_menu_wallpaper, len);
else
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
@ -214,9 +215,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS:
{
#ifdef HAVE_MENU
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const char *menu_ident = settings->arrays.menu_driver;
char *s1 = (char*)calloc(1, PATH_MAX_LENGTH * sizeof(char));
const char *dir_assets = settings->paths.directory_assets;
char *s1 = (char*)calloc(
1, PATH_MAX_LENGTH * sizeof(char));
if (string_is_equal(menu_ident, "xmb"))
{
@ -243,9 +246,7 @@ void fill_pathname_application_special(char *s,
if (string_is_empty(s1))
{
fill_pathname_join(
s1,
settings->paths.directory_assets,
"sounds",
s1, dir_assets, "sounds",
PATH_MAX_LENGTH * sizeof(char)
);
}
@ -259,15 +260,14 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE:
#ifdef HAVE_OZONE
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *s1 = (char*)malloc(
PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
s1[0] = '\0';
fill_pathname_join(
s1,
settings->paths.directory_assets,
"ozone",
fill_pathname_join(s1, dir_assets, "ozone",
PATH_MAX_LENGTH * sizeof(char)
);
strlcpy(s, s1, len);
@ -278,15 +278,14 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB:
#ifdef HAVE_XMB
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *s1 = (char*)malloc(
PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
s1[0] = '\0';
fill_pathname_join(
s1,
settings->paths.directory_assets,
"xmb",
fill_pathname_join(s1, dir_assets, "xmb",
PATH_MAX_LENGTH * sizeof(char)
);
fill_pathname_join(s,
@ -298,13 +297,10 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI:
#ifdef HAVE_MATERIALUI
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(
s,
settings->paths.directory_assets,
"glui",
len);
fill_pathname_join(s, dir_assets, "glui", len);
}
#endif
break;
@ -343,10 +339,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT:
#ifdef HAVE_XMB
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
const char *path_menu_xmb_font = settings->paths.path_menu_xmb_font;
if (!string_is_empty(settings->paths.path_menu_xmb_font))
strlcpy(s, settings->paths.path_menu_xmb_font, len);
if (!string_is_empty(path_menu_xmb_font))
strlcpy(s, path_menu_xmb_font, len);
else
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
@ -364,17 +361,15 @@ void fill_pathname_application_special(char *s,
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS:
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
s1[0] = '\0';
s2[0] = '\0';
fill_pathname_join(s1,
settings->paths.directory_thumbnails,
"discord",
len);
fill_pathname_join(s1, dir_thumbnails, "discord", len);
fill_pathname_join(s2,
s1, "avatars",
PATH_MAX_LENGTH * sizeof(char)
@ -390,17 +385,17 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES:
{
char *s1 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *s2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
char *s1 = (char*)malloc(
PATH_MAX_LENGTH * sizeof(char));
char *s2 = (char*)malloc(
PATH_MAX_LENGTH * sizeof(char));
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
s1[0] = '\0';
s2[0] = '\0';
fill_pathname_join(s1,
settings->paths.directory_thumbnails,
"cheevos",
len);
fill_pathname_join(s1, dir_thumbnails, "cheevos", len);
fill_pathname_join(s2,
s1, "badges",
PATH_MAX_LENGTH * sizeof(char)