From 0254d8714d8f57446934749f907fd17d344a71e1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 17 Sep 2016 14:04:19 +0200 Subject: [PATCH] Create config append functions --- paths.c | 36 ++++++++++++++++++++++++++++++++++++ paths.h | 8 ++++++++ 2 files changed, 44 insertions(+) diff --git a/paths.c b/paths.c index 761f2f4e7c..de8a56faf5 100644 --- a/paths.c +++ b/paths.c @@ -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) diff --git a/paths.h b/paths.h index 8c5c631f20..3edebe37ac 100644 --- a/paths.h +++ b/paths.h @@ -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);