mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
Move rarch_extract_directory to file_path.c and rename it
fill_pathname_basedir
This commit is contained in:
parent
eff526076b
commit
f4559bf636
@ -39,18 +39,3 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
|
||||
wcstombs(str, wstr, sizeof(str));
|
||||
return str;
|
||||
}
|
||||
|
||||
void rarch_extract_directory(char *buf, const char *path, size_t size)
|
||||
{
|
||||
strncpy(buf, path, size - 1);
|
||||
buf[size - 1] = '\0';
|
||||
|
||||
char *base = strrchr(buf, '/');
|
||||
if (!base)
|
||||
base = strrchr(buf, '\\');
|
||||
|
||||
if (base)
|
||||
*base = '\0';
|
||||
else
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
@ -80,6 +80,5 @@ extern default_paths_t default_paths;
|
||||
|
||||
void rarch_convert_char_to_wchar(wchar_t *buf, const char * str, size_t size);
|
||||
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
|
||||
void rarch_extract_directory(char *buf, const char *path, size_t size);
|
||||
|
||||
#endif
|
||||
|
@ -23,6 +23,9 @@
|
||||
// sane name.
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
|
||||
static void rarch_console_name_from_id(char *name, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
@ -150,7 +153,6 @@ bool rarch_manage_libretro_extension_supported(const char *filename)
|
||||
return ext_supported;
|
||||
}
|
||||
|
||||
// Transforms a library id to a name suitable as a pathname.
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -64,7 +64,7 @@ void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode, u
|
||||
#ifdef HAVE_ZLIB
|
||||
if(extract_zip_cond)
|
||||
{
|
||||
rarch_extract_directory(dir_path_temp, rom_path_temp, sizeof(dir_path_temp));
|
||||
fill_pathname_basedir(dir_path_temp, rom_path_temp, sizeof(dir_path_temp));
|
||||
rarch_extract_zipfile(rom_path_temp, dir_path_temp, first_file, sizeof(first_file), extract_zip_mode);
|
||||
|
||||
#ifndef GEKKO
|
||||
|
3
file.h
3
file.h
@ -94,4 +94,7 @@ void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replac
|
||||
// Copies basename of in_path into out_path.
|
||||
void fill_pathname_base(char *out_path, const char *in_path, size_t size);
|
||||
|
||||
// Copies base directory of in_path into out_path.
|
||||
void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
|
||||
|
||||
#endif
|
||||
|
14
file_path.c
14
file_path.c
@ -386,3 +386,17 @@ void fill_pathname_base(char *out_dir, const char *in_path, size_t size)
|
||||
rarch_assert(strlcpy(out_dir, ptr, size) < size);
|
||||
}
|
||||
|
||||
void fill_pathname_basedir(char *out_dir, const char *in_path, size_t size)
|
||||
{
|
||||
strncpy(out_dir, in_path, size - 1);
|
||||
out_dir[size - 1] = '\0';
|
||||
|
||||
char *base = strrchr(out_dir, '/');
|
||||
if (!base)
|
||||
base = strrchr(out_dir, '\\');
|
||||
|
||||
if (base)
|
||||
*base = '\0';
|
||||
else
|
||||
out_dir[0] = '\0';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user