diff --git a/Makefile.common b/Makefile.common index 5ea97d3e130..26b03cd8215 100644 --- a/Makefile.common +++ b/Makefile.common @@ -150,6 +150,7 @@ OBJ += frontend/frontend.o \ libretro-common/file/nbio/nbio_stdio.o \ libretro-common/file/file_path.o \ file_path_special.o \ + file_path_str.o \ libretro-common/hash/rhash.o \ audio/audio_driver.o \ input/input_driver.o \ diff --git a/Makefile.ps3.salamander b/Makefile.ps3.salamander index 1fea230bbe0..3abf7340c1b 100644 --- a/Makefile.ps3.salamander +++ b/Makefile.ps3.salamander @@ -33,6 +33,7 @@ PPU_SRCS = frontend/frontend_salamander.c \ libretro-common/compat/compat_strl.c \ libretro-common/streams/file_stream.c \ libretro-common/file/config_file.c \ + file_path_str.c \ verbosity.c ifeq ($(HAVE_LOGGER), 1) diff --git a/configuration.c b/configuration.c index 32bb59c7735..2f774a4ea90 100644 --- a/configuration.c +++ b/configuration.c @@ -941,7 +941,7 @@ static config_file_t *open_default_config_file(void) #if defined(_WIN32) && !defined(_XBOX) fill_pathname_application_path(app_path, sizeof(app_path)); fill_pathname_resolve_relative(conf_path, app_path, - "retroarch.cfg", sizeof(conf_path)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(conf_path)); conf = config_file_new(conf_path); @@ -951,7 +951,7 @@ static config_file_t *open_default_config_file(void) sizeof(application_data))) { fill_pathname_join(conf_path, application_data, - "retroarch.cfg", sizeof(conf_path)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(conf_path)); conf = config_file_new(conf_path); } } @@ -969,7 +969,7 @@ static config_file_t *open_default_config_file(void) /* Since this is a clean config file, we can * safely use config_save_on_exit. */ fill_pathname_resolve_relative(conf_path, app_path, - "retroarch.cfg", sizeof(conf_path)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(conf_path)); config_set_bool(conf, "config_save_on_exit", true); saved = config_file_write(conf, conf_path); } @@ -993,7 +993,7 @@ static config_file_t *open_default_config_file(void) path_mkdir(application_data); fill_pathname_join(conf_path, application_data, - "retroarch.cfg", sizeof(conf_path)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(conf_path)); conf = config_file_new(conf_path); if (!conf) @@ -1027,7 +1027,7 @@ static config_file_t *open_default_config_file(void) if (has_application_data) { fill_pathname_join(conf_path, application_data, - "retroarch.cfg", sizeof(conf_path)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(conf_path)); RARCH_LOG("Looking for config in: \"%s\".\n", conf_path); conf = config_file_new(conf_path); } @@ -1051,7 +1051,7 @@ static config_file_t *open_default_config_file(void) fill_pathname_basedir(basedir, conf_path, sizeof(basedir)); - fill_pathname_join(conf_path, conf_path, "retroarch.cfg", sizeof(conf_path)); + fill_pathname_join(conf_path, conf_path, file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(conf_path)); if (path_mkdir(basedir)) { @@ -1059,7 +1059,7 @@ static config_file_t *open_default_config_file(void) char skeleton_conf[PATH_MAX_LENGTH] = {0}; fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR, - "retroarch.cfg", sizeof(skeleton_conf)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(skeleton_conf)); conf = config_file_new(skeleton_conf); if (conf) RARCH_WARN("Config: using skeleton config \"%s\" as base for a new config file.\n", skeleton_conf); diff --git a/file_path_special.c b/file_path_special.c index 3ed04e0cb5c..c6902bd622b 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -425,17 +425,3 @@ void fill_pathname_application_special(char *s, size_t len, enum application_spe break; } } - -const char *file_path_str(enum file_path_enum enum_idx) -{ - switch (enum_idx) - { - case FILE_PATH_CONTENT_HISTORY: - return "content_history.lpl"; - case FILE_PATH_UNKNOWN: - default: - break; - } - - return "null"; -} diff --git a/file_path_special.h b/file_path_special.h index ec0cefbac17..b073d001071 100644 --- a/file_path_special.h +++ b/file_path_special.h @@ -25,7 +25,8 @@ enum file_path_enum { FILE_PATH_UNKNOWN = 0, - FILE_PATH_CONTENT_HISTORY + FILE_PATH_CONTENT_HISTORY, + FILE_PATH_MAIN_CONFIG }; enum application_special_type diff --git a/file_path_str.c b/file_path_str.c new file mode 100644 index 00000000000..99af59ab3ab --- /dev/null +++ b/file_path_str.c @@ -0,0 +1,32 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2016 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "file_path_special.h" + +const char *file_path_str(enum file_path_enum enum_idx) +{ + switch (enum_idx) + { + case FILE_PATH_CONTENT_HISTORY: + return "content_history.lpl"; + case FILE_PATH_MAIN_CONFIG: + return "retroarch.cfg"; + case FILE_PATH_UNKNOWN: + default: + break; + } + + return "null"; +} diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index cadf9c09cd7..d28f9dfb8fc 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -81,7 +81,7 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], fill_pathname_join(g_defaults.dir.video_filter, g_defaults.dir.port, "filters", sizeof(g_defaults.dir.remap)); fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, - "retroarch.cfg", sizeof(g_defaults.path.config)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); } static void frontend_ctr_deinit(void *data) diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index 24b0590dd17..7849c7ea925 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -362,7 +362,8 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[], fill_pathname_join(g_defaults.dir.assets, home_dir_buf, "assets", sizeof(g_defaults.dir.assets)); fill_pathname_join(g_defaults.dir.system, home_dir_buf, "system", sizeof(g_defaults.dir.system)); fill_pathname_join(g_defaults.dir.menu_config, home_dir_buf, "config", sizeof(g_defaults.dir.menu_config)); - fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, "retroarch.cfg", sizeof(g_defaults.path.config)); + fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); fill_pathname_join(g_defaults.dir.database, home_dir_buf, "database/rdb", sizeof(g_defaults.dir.database)); fill_pathname_join(g_defaults.dir.cursor, home_dir_buf, "database/cursors", sizeof(g_defaults.dir.cursor)); @@ -387,7 +388,8 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[], fill_pathname_join(g_defaults.dir.playlist, application_data, "playlists", sizeof(g_defaults.dir.playlist)); fill_pathname_join(g_defaults.dir.thumbnails, application_data, "thumbnails", sizeof(g_defaults.dir.thumbnails)); fill_pathname_join(g_defaults.dir.menu_config, application_data, "config", sizeof(g_defaults.dir.menu_config)); - fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, "retroarch.cfg", sizeof(g_defaults.path.config)); + fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); fill_pathname_join(g_defaults.dir.core_assets, application_data, "downloads", sizeof(g_defaults.dir.core_assets)); fill_pathname_join(g_defaults.dir.screenshot, application_data, "screenshots", sizeof(g_defaults.dir.screenshot)); diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index 61e28abc26a..94ad2274fb5 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -33,6 +33,7 @@ #endif #include "../frontend_driver.h" +#include "../../file_path_special.h" #include "../../defines/ps3_defines.h" #include "../../defaults.h" #include "../../verbosity.h" @@ -221,7 +222,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[], fill_pathname_join(g_defaults.dir.shader, g_defaults.dir.core, "shaders_cg", sizeof(g_defaults.dir.shader)); fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, - "retroarch.cfg", sizeof(g_defaults.path.config)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); fill_pathname_join(g_defaults.dir.overlay, g_defaults.dir.core, "overlays", sizeof(g_defaults.dir.overlay)); fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.core, diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index 92b14117062..8a5f908371b 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -107,7 +107,7 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[], fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core, "playlists", sizeof(g_defaults.dir.playlist)); fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, - "retroarch.cfg", sizeof(g_defaults.path.config)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); fill_pathname_join(g_defaults.dir.cheats, g_defaults.dir.port, "cheats", sizeof(g_defaults.dir.cheats)); fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port, diff --git a/frontend/drivers/platform_qnx.c b/frontend/drivers/platform_qnx.c index 41f6d3d7858..90601536c72 100644 --- a/frontend/drivers/platform_qnx.c +++ b/frontend/drivers/platform_qnx.c @@ -50,7 +50,7 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[], void *data, void *params_data) { fill_pathname_join(g_defaults.path.config, "app/native", - "retroarch.cfg", sizeof(g_defaults.path.config)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); fill_pathname_join(g_defaults.dir.shader, "app/native", "shaders_glsl", sizeof(g_defaults.dir.shader)); fill_pathname_join(g_defaults.dir.overlay, "app/native", diff --git a/frontend/drivers/platform_xdk.cpp b/frontend/drivers/platform_xdk.cpp index e88020cc350..90bfe9bd8d6 100644 --- a/frontend/drivers/platform_xdk.cpp +++ b/frontend/drivers/platform_xdk.cpp @@ -1127,7 +1127,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[], strlcpy(g_defaults.dir.core, "D:", sizeof(g_defaults.dir.core)); strlcpy(g_defaults.dir.core_info, "D:", sizeof(g_defaults.dir.core_info)); fill_pathname_join(g_defaults.path.config, g_defaults.dir.core, - "retroarch.cfg", sizeof(g_defaults.path.config)); + file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.core, "savestates", sizeof(g_defaults.dir.savestate)); fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.core, diff --git a/griffin/griffin.c b/griffin/griffin.c index afd3e57b801..639759c8acf 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -653,6 +653,7 @@ FILE ============================================================ */ #include "../libretro-common/file/file_path.c" #include "../file_path_special.c" +#include "../file_path_str.c" #include "../libretro-common/lists/dir_list.c" #include "../libretro-common/lists/string_list.c" #include "../libretro-common/lists/file_list.c"