mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 05:24:21 +01:00
Dynamic buffers for filenames
This commit is contained in:
parent
fecfac664f
commit
00ee6da738
@ -69,10 +69,11 @@ public:
|
||||
"%s/%s", this->cur_path_prefix, fileName);
|
||||
|
||||
if (ext_matches_list(fileName, prg_exts)) {
|
||||
char tmp_filename[255];
|
||||
char *tmp_filename;
|
||||
FILE *src, *dst;
|
||||
|
||||
snprintf(tmp_filename, sizeof(tmp_filename), "%s/a", Gui::gui->tmp_path);
|
||||
tmp_filename = (char *)xmalloc(strlen(Gui::gui->tmp_path) + 4);
|
||||
sprintf(tmp_filename, "%s/a", Gui::gui->tmp_path);
|
||||
|
||||
/* Clean temp dir first (we only want one file) */
|
||||
unlink(tmp_filename);
|
||||
@ -99,6 +100,7 @@ public:
|
||||
}
|
||||
fclose(src);
|
||||
}
|
||||
free(tmp_filename);
|
||||
}
|
||||
|
||||
Gui::gui->timerController->disarm(this);
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
virtual void selectCallback(int which)
|
||||
{
|
||||
const char *fileName = this->pp_msgs[this->cur_sel];
|
||||
char buf[255];
|
||||
char *new_path;
|
||||
|
||||
/* If we selected a directory, just take the next one */
|
||||
if (fileName[0] == '[')
|
||||
@ -66,13 +66,15 @@ public:
|
||||
this->pushDirectory(fileName);
|
||||
return;
|
||||
}
|
||||
new_path = (char *)xmalloc(strlen(this->cur_path_prefix) + 3 + strlen(fileName));
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s",
|
||||
sprintf(new_path, "%s/%s",
|
||||
this->cur_path_prefix, fileName);
|
||||
if (this->loadSnapshot)
|
||||
TheC64->LoadSnapshot(buf);
|
||||
TheC64->LoadSnapshot(new_path);
|
||||
else
|
||||
unlink(buf);
|
||||
unlink(new_path);
|
||||
free(new_path);
|
||||
Gui::gui->popView();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user