mirror of
https://github.com/libretro/RetroArch
synced 2025-02-02 14:54:10 +00:00
Let $XDG_CONFIG_HOME fallback to $HOME/.config.
Use the specification more correctly. Keep fallback to $HOME/.retroarch.cfg.
This commit is contained in:
parent
5b2a5c76b5
commit
7fadee0da3
@ -73,7 +73,7 @@ When loading a rom from stdin, the path must be a full path, however.
|
|||||||
If a config cannot be found when using directory path, the default config path will be used instead.
|
If a config cannot be found when using directory path, the default config path will be used instead.
|
||||||
|
|
||||||
.IP
|
.IP
|
||||||
Unix-like systems will look in $XDG_CONFIG_HOME/retroarch/retroarch.cfg first. Then it will try $HOME/.retroarch.cfg. Last, it will try /etc/retroarch.cfg. If no configuration is found, default settings will be assumed. A configuration file does not need to define every possible option, only those that should be overridden.
|
Unix-like systems will look in $XDG_CONFIG_HOME/retroarch/retroarch.cfg first. If $XDG_CONFIG_HOME is not defined, it is assumed to be $HOME/.config as per specification. Then it will try $HOME/.retroarch.cfg. Last, it will try /etc/retroarch.cfg. If no configuration is found, default settings will be assumed. A configuration file does not need to define every possible option, only those that should be overridden.
|
||||||
|
|
||||||
.IP
|
.IP
|
||||||
Windows will look in retroarch.cfg in same folder where retroarch.exe resides.
|
Windows will look in retroarch.cfg in same folder where retroarch.exe resides.
|
||||||
|
@ -569,10 +569,8 @@ static int16_t input_state(unsigned port, unsigned device, unsigned index, unsig
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define RARCH_DEFAULT_CONF_PATH_STR "\n\t\tDefaults to retroarch.cfg in same directory as retroarch.exe."
|
#define RARCH_DEFAULT_CONF_PATH_STR "\n\t\tDefaults to retroarch.cfg in same directory as retroarch.exe."
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#define RARCH_DEFAULT_CONF_PATH_STR " Defaults to $HOME/.retroarch.cfg."
|
|
||||||
#else
|
#else
|
||||||
#define RARCH_DEFAULT_CONF_PATH_STR " Defaults to $XDG_CONFIG_HOME/retroarch/retroarch.cfg,\n\t\tor $HOME/.retroarch.cfg, if $XDG_CONFIG_HOME is not defined."
|
#define RARCH_DEFAULT_CONF_PATH_STR "\n\t\tBy default looks for config in $XDG_CONFIG_HOME/retroarch/retroarch.cfg,\n\t\t$HOME/.config/retroarch/retroarch.cfg,\n\t\tand $HOME/.retroarch.cfg."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.features.h"
|
#include "config.features.h"
|
||||||
|
35
settings.c
35
settings.c
@ -329,36 +329,37 @@ static config_file_t *open_default_config_file(void)
|
|||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__)
|
|
||||||
char conf_path[PATH_MAX];
|
|
||||||
const char *home = getenv("HOME");
|
|
||||||
if (home)
|
|
||||||
{
|
|
||||||
snprintf(conf_path, sizeof(conf_path), "%s/.retroarch.cfg", home);
|
|
||||||
conf = config_file_new(conf_path);
|
|
||||||
}
|
|
||||||
if (!conf)
|
|
||||||
conf = config_file_new("/etc/retroarch.cfg");
|
|
||||||
#elif !defined(__CELLOS_LV2__) && !defined(_XBOX)
|
#elif !defined(__CELLOS_LV2__) && !defined(_XBOX)
|
||||||
char conf_path[PATH_MAX];
|
char conf_path[PATH_MAX];
|
||||||
const char *xdg = getenv("XDG_CONFIG_HOME");
|
const char *xdg = getenv("XDG_CONFIG_HOME");
|
||||||
if (!xdg)
|
|
||||||
RARCH_WARN("XDG_CONFIG_HOME is not defined. Will look for config in $HOME/.retroarch.cfg ...\n");
|
|
||||||
|
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
|
// XDG_CONFIG_HOME falls back to $HOME/.config.
|
||||||
if (xdg)
|
if (xdg)
|
||||||
{
|
|
||||||
snprintf(conf_path, sizeof(conf_path), "%s/retroarch/retroarch.cfg", xdg);
|
snprintf(conf_path, sizeof(conf_path), "%s/retroarch/retroarch.cfg", xdg);
|
||||||
|
else if (home)
|
||||||
|
snprintf(conf_path, sizeof(conf_path), "%s/.config/retroarch/retroarch.cfg", home);
|
||||||
|
|
||||||
|
if (xdg || home)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
}
|
}
|
||||||
else if (home)
|
|
||||||
|
// Fallback to $HOME/.retroarch.cfg.
|
||||||
|
if (!conf && home)
|
||||||
{
|
{
|
||||||
snprintf(conf_path, sizeof(conf_path), "%s/.retroarch.cfg", home);
|
snprintf(conf_path, sizeof(conf_path), "%s/.retroarch.cfg", home);
|
||||||
|
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
|
||||||
conf = config_file_new(conf_path);
|
conf = config_file_new(conf_path);
|
||||||
}
|
}
|
||||||
// Try this as a last chance...
|
|
||||||
|
// Try this as a last chance ...
|
||||||
if (!conf)
|
if (!conf)
|
||||||
|
{
|
||||||
conf = config_file_new("/etc/retroarch.cfg");
|
conf = config_file_new("/etc/retroarch.cfg");
|
||||||
|
RARCH_LOG("Looking for config in: \"/etc/retroarch.cfg\".\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user