mirror of
https://github.com/libretro/RetroArch
synced 2024-12-28 09:29:16 +00:00
Create dir_get_current_savefile and move it to dirs.c
This commit is contained in:
parent
e17d567b8d
commit
50bfd81e42
22
dirs.c
22
dirs.c
@ -29,6 +29,8 @@
|
||||
#include "list_special.h"
|
||||
#include "file_path_special.h"
|
||||
#include "msg_hash.h"
|
||||
#include "paths.h"
|
||||
#include "content.h"
|
||||
#include "runloop.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
@ -40,10 +42,11 @@ struct rarch_dir_list
|
||||
|
||||
static struct rarch_dir_list dir_shader_list;
|
||||
|
||||
static char dir_osk_overlay[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_system[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_savefile[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_savestate[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_osk_overlay[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_system[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_savefile[PATH_MAX_LENGTH] = {0};
|
||||
char current_savefile_dir[PATH_MAX_LENGTH] = {0};
|
||||
static char dir_savestate[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
static bool shader_dir_init(struct rarch_dir_list *dir_list)
|
||||
{
|
||||
@ -264,6 +267,17 @@ char *dir_get_savestate_ptr(void)
|
||||
|
||||
/* get functions */
|
||||
|
||||
const char *dir_get_current_savefile(void)
|
||||
{
|
||||
/* try to infer the path in case it's still empty by calling
|
||||
path_set_redirect */
|
||||
if (string_is_empty(current_savefile_dir)
|
||||
&& !content_does_not_need_content())
|
||||
path_set_redirect();
|
||||
|
||||
return current_savefile_dir;
|
||||
}
|
||||
|
||||
const char *dir_get_osk_overlay(void)
|
||||
{
|
||||
return dir_osk_overlay;
|
||||
|
2
dirs.h
2
dirs.h
@ -87,6 +87,8 @@ const char *dir_get_savestate(void);
|
||||
|
||||
const char *dir_get_system(void);
|
||||
|
||||
const char *dir_get_current_savefile(void);
|
||||
|
||||
/* set functions */
|
||||
|
||||
void dir_set_osk_overlay(const char *path);
|
||||
|
@ -1051,9 +1051,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY:
|
||||
*(const char**)data = path_get_current_savefile_dir();
|
||||
RARCH_LOG("Environ GET_SAVE_DIRECTORY: \"%s\".\n",
|
||||
path_get_current_savefile_dir());
|
||||
*(const char**)data = dir_get_current_savefile();
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_USERNAME:
|
||||
|
20
paths.c
20
paths.c
@ -48,7 +48,8 @@
|
||||
|
||||
#define MENU_VALUE_NO_CORE 0x7d5472cbU
|
||||
|
||||
/* For --subsystem content. */
|
||||
extern char current_savefile_dir[PATH_MAX_LENGTH];
|
||||
|
||||
static struct string_list *subsystem_fullpaths = NULL;
|
||||
|
||||
char subsystem_path[PATH_MAX_LENGTH] = {0};
|
||||
@ -57,7 +58,7 @@ static char path_default_shader_preset[PATH_MAX_LENGTH] = {0};
|
||||
static char path_main_basename[PATH_MAX_LENGTH] = {0}
|
||||
;
|
||||
static char path_content[PATH_MAX_LENGTH] = {0};
|
||||
static char current_savefile_dir[PATH_MAX_LENGTH] = {0};
|
||||
static char current_savestate_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};
|
||||
@ -66,7 +67,6 @@ static char path_core_options_file[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
void path_set_redirect(void)
|
||||
{
|
||||
char current_savestate_dir[PATH_MAX_LENGTH] = {0};
|
||||
uint32_t library_name_hash = 0;
|
||||
bool check_library_name_hash = false;
|
||||
rarch_system_info_t *info = NULL;
|
||||
@ -86,6 +86,7 @@ void path_set_redirect(void)
|
||||
strlcpy(current_savefile_dir,
|
||||
old_savefile_dir,
|
||||
sizeof(current_savefile_dir));
|
||||
|
||||
strlcpy(current_savestate_dir,
|
||||
old_savestate_dir,
|
||||
sizeof(current_savestate_dir));
|
||||
@ -101,7 +102,7 @@ void path_set_redirect(void)
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* per-core saves: append the library_name to the save location */
|
||||
if (settings->sort_savefiles_enable
|
||||
if ( settings->sort_savefiles_enable
|
||||
&& !string_is_empty(old_savefile_dir))
|
||||
{
|
||||
fill_pathname_join(
|
||||
@ -249,17 +250,6 @@ struct string_list *path_get_subsystem_list(void)
|
||||
return subsystem_fullpaths;
|
||||
}
|
||||
|
||||
const char *path_get_current_savefile_dir(void)
|
||||
{
|
||||
/* try to infer the path in case it's still empty by calling
|
||||
path_set_redirect */
|
||||
if (string_is_empty(current_savefile_dir)
|
||||
&& !content_does_not_need_content())
|
||||
path_set_redirect();
|
||||
|
||||
return current_savefile_dir;
|
||||
}
|
||||
|
||||
void path_set_special(char **argv, unsigned num_content)
|
||||
{
|
||||
unsigned i;
|
||||
|
Loading…
Reference in New Issue
Block a user