mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 15:32:59 +00:00
Basenames should now be correct also when using zipfiles. It is now always only the basename of the file in the zipfile. So if zipname == internalname, its zipname, like requested here: https://github.com/libretro/RetroArch/issues/1030#issuecomment-55810822
This commit is contained in:
parent
125377b528
commit
95f02d12f4
16
file_path.c
16
file_path.c
@ -417,6 +417,22 @@ void fill_pathname_base(char *out, const char *in_path, size_t size)
|
|||||||
else
|
else
|
||||||
ptr = in_path;
|
ptr = in_path;
|
||||||
|
|
||||||
|
/* In case of compression, we also have to consider paths like
|
||||||
|
* /path/to/archive.7z#mygame.img
|
||||||
|
* and
|
||||||
|
* /path/to/archive.7z#folder/mygame.img
|
||||||
|
* basename would be mygame.img in both cases
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_COMPRESSION
|
||||||
|
const char *ptr_bak = ptr;
|
||||||
|
ptr = strchr(ptr,'#');
|
||||||
|
if (ptr)
|
||||||
|
ptr++;
|
||||||
|
else
|
||||||
|
ptr = ptr_bak;
|
||||||
|
#endif
|
||||||
|
|
||||||
rarch_assert(strlcpy(out, ptr, size) < size);
|
rarch_assert(strlcpy(out, ptr, size) < size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ static void set_basename(const char *path)
|
|||||||
char *dst = NULL;
|
char *dst = NULL;
|
||||||
|
|
||||||
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
|
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
|
||||||
strlcpy(g_extern.basename, path, sizeof(g_extern.basename));
|
fill_pathname_base(g_extern.basename, path, sizeof(g_extern.basename));
|
||||||
|
|
||||||
if ((dst = strrchr(g_extern.basename, '.')))
|
if ((dst = strrchr(g_extern.basename, '.')))
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user