Create config append functions

This commit is contained in:
twinaphex 2016-09-17 14:04:19 +02:00
parent 98d325ad67
commit 0254d8714d
2 changed files with 44 additions and 0 deletions

36
paths.c
View File

@ -45,6 +45,7 @@
static char current_savefile_dir[PATH_MAX_LENGTH] = {0};
static char path_libretro[PATH_MAX_LENGTH] = {0};
static char path_config_file[PATH_MAX_LENGTH] = {0};
static char path_config_append_file[PATH_MAX_LENGTH] = {0};
/* Config file associated with per-core configs. */
static char path_core_options_file[PATH_MAX_LENGTH] = {0};
@ -418,6 +419,8 @@ void path_fill_names(void)
sizeof(global->name.ips));
}
/* Core file path */
char *path_get_core_ptr(void)
{
return path_libretro;
@ -448,6 +451,8 @@ void path_clear_core(void)
*path_libretro = '\0';
}
/* Config file path */
bool path_is_config_empty(void)
{
if (string_is_empty(path_config_file))
@ -474,6 +479,8 @@ void path_clear_config(void)
*path_config_file = '\0';
}
/* Core options file path */
bool path_is_core_options_empty(void)
{
if (string_is_empty(path_core_options_file))
@ -500,11 +507,40 @@ const char *path_get_core_options(void)
return NULL;
}
/* Append config file path */
bool path_is_config_append_empty(void)
{
if (string_is_empty(path_config_append_file))
return true;
return false;
}
void path_clear_config_append(void)
{
*path_config_append_file = '\0';
}
void path_set_config_append(const char *path)
{
strlcpy(path_config_append_file, path, sizeof(path_config_append_file));
}
const char *path_get_config_append(void)
{
if (!path_is_config_append_empty())
return path_config_append_file;
return NULL;
}
void path_clear_all(void)
{
global_t *global = global_get_ptr();
path_clear_config();
path_clear_config_append();
path_clear_core_options();
if (global)

View File

@ -39,6 +39,8 @@ void path_set_core_options(const char *path);
void path_set_config(const char *path);
void path_set_config_append(const char *path);
char *path_get_core_ptr(void);
const char *path_get_current_savefile_dir(void);
@ -49,6 +51,8 @@ const char *path_get_core_options(void);
const char *path_get_config(void);
const char *path_get_config_append(void);
size_t path_get_core_size(void);
bool path_is_core_empty(void);
@ -57,12 +61,16 @@ bool path_is_config_empty(void);
bool path_is_core_options_empty(void);
bool path_is_config_append_empty(void);
void path_clear_core(void);
void path_clear_config(void);
void path_clear_core_options(void);
void path_clear_config_append(void);
void path_clear_all(void);
enum rarch_content_type path_is_media_type(const char *path);