Correctly delete save files.
This commit is contained in:
parent
8339109f58
commit
726243fcfe
|
@ -502,10 +502,10 @@ void deleteSaveSlot(int slot)
|
|||
sprintf(path, "%s/%d", app.saveDir, slot);
|
||||
|
||||
filenames = getFileList(path, &numFiles);
|
||||
|
||||
|
||||
for (i = 0 ; i < numFiles ; i++)
|
||||
{
|
||||
sprintf(path, "%s/%d/%s", app.saveDir, i, filenames[i]);
|
||||
sprintf(path, "%s/%d/%s", app.saveDir, slot, filenames[i]);
|
||||
|
||||
if (!deleteFile(path))
|
||||
{
|
||||
|
|
|
@ -323,6 +323,8 @@ static void doOK(void)
|
|||
|
||||
saveSlot = game.saveSlot;
|
||||
|
||||
deleteSaveSlot(saveSlot);
|
||||
|
||||
stopMusic();
|
||||
|
||||
newGame();
|
||||
|
|
|
@ -53,6 +53,7 @@ extern void setSelectedWidget(char *name, char *group);
|
|||
extern void showWidgetGroup(char *group);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern void deleteSaveSlot(int slot);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -197,7 +197,7 @@ char **getFileList(const char *dir, int *count)
|
|||
|
||||
int deleteFile(char *path)
|
||||
{
|
||||
return unlink(path);
|
||||
return unlink(path) == 0;
|
||||
}
|
||||
|
||||
static int stringComparator(const void *a, const void *b)
|
||||
|
|
Loading…
Reference in New Issue