(Console) don't delete the wrong file on when loading a second rom after loading one in a zip file

This commit is contained in:
ToadKing 2013-01-21 20:18:11 -05:00
parent 39daa377c6
commit 6d174dcc3b
3 changed files with 6 additions and 3 deletions

2
file.c
View File

@ -652,6 +652,8 @@ bool init_rom_file(enum rarch_game_type type)
if (ext && !strcasecmp(ext, "zip"))
{
g_extern.rom_file_temporary = true;
strlcpy(g_extern.last_rom, g_extern.fullpath, sizeof(g_extern.last_rom));
if (!zlib_extract_first_rom(g_extern.fullpath, sizeof(g_extern.fullpath), g_extern.system.valid_extensions))
{
RARCH_ERR("Failed to extract ROM from zipped file: %s.\n", g_extern.fullpath);

View File

@ -305,6 +305,7 @@ struct global
bool has_multitap;
bool rom_file_temporary;
char last_rom[PATH_MAX];
enum rarch_game_type game_type;
uint32_t cart_crc;

View File

@ -2906,9 +2906,9 @@ void rarch_main_deinit(void)
if (g_extern.rom_file_temporary)
{
RARCH_LOG("Removing tempoary ROM file: %s.\n", g_extern.fullpath);
if (remove(g_extern.fullpath) < 0)
RARCH_ERR("Failed to remove temporary file: %s.\n", g_extern.fullpath);
RARCH_LOG("Removing tempoary ROM file: %s.\n", g_extern.last_rom);
if (remove(g_extern.last_rom) < 0)
RARCH_ERR("Failed to remove temporary file: %s.\n", g_extern.last_rom);
g_extern.rom_file_temporary = false;
}