mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Simplify get_temp_directory_alloc
This commit is contained in:
parent
e31ba43b5a
commit
d7c2eba4fd
21
retroarch.c
21
retroarch.c
@ -10832,13 +10832,13 @@ static void clear_controller_port_map(void)
|
|||||||
|
|
||||||
static char *get_temp_directory_alloc(void)
|
static char *get_temp_directory_alloc(void)
|
||||||
{
|
{
|
||||||
|
const char *src;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef LEGACY_WIN32
|
#ifdef LEGACY_WIN32
|
||||||
DWORD path_length = GetTempPath(0, NULL) + 1;
|
DWORD path_length = GetTempPath(0, NULL) + 1;
|
||||||
path = (char*)malloc(path_length * sizeof(char));
|
|
||||||
|
|
||||||
if (!path)
|
if (!(path = (char*)malloc(path_length * sizeof(char))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
path[path_length - 1] = 0;
|
path[path_length - 1] = 0;
|
||||||
@ -10856,17 +10856,16 @@ static char *get_temp_directory_alloc(void)
|
|||||||
path = utf16_to_utf8_string_alloc(wide_str);
|
path = utf16_to_utf8_string_alloc(wide_str);
|
||||||
free(wide_str);
|
free(wide_str);
|
||||||
#endif
|
#endif
|
||||||
#elif defined ANDROID
|
#else
|
||||||
{
|
#if defined ANDROID
|
||||||
settings_t *settings = configuration_settings;
|
src = configuration_settings->paths.directory_libretro;
|
||||||
path = strcpy_alloc_force(settings->paths.directory_libretro);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if (getenv("TMPDIR"))
|
if (getenv("TMPDIR"))
|
||||||
path = strcpy_alloc_force(getenv("TMPDIR"));
|
src = getenv("TMPDIR");
|
||||||
else
|
else
|
||||||
path = strcpy_alloc_force("/tmp");
|
src = "/tmp";
|
||||||
|
#endif
|
||||||
|
path = strcpy_alloc_force(src);
|
||||||
#endif
|
#endif
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user