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:
Timo Strunk 2014-09-17 18:41:23 +02:00
parent 125377b528
commit 95f02d12f4
2 changed files with 17 additions and 1 deletions

View File

@ -417,6 +417,22 @@ void fill_pathname_base(char *out, const char *in_path, size_t size)
else
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);
}

View File

@ -1022,7 +1022,7 @@ static void set_basename(const char *path)
char *dst = NULL;
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, '.')))
*dst = '\0';