Report success for deleting files that don't exist! (save game regression).

This commit is contained in:
Steve 2019-12-02 07:47:16 +00:00
parent 13c8c9c05a
commit 1a684a9737
2 changed files with 19 additions and 7 deletions

View File

@ -1,5 +1,5 @@
VERSION = 1.2
REVISION = 1
REVISION = 2
LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po))
OUT = bin

View File

@ -63,7 +63,9 @@ char *readFile(const char *filename)
{
char *buffer = 0;
unsigned long length;
FILE *file = fopen(getFileLocation(filename), "rb");
FILE *file;
file = fopen(getFileLocation(filename), "rb");
if (file)
{
@ -88,8 +90,9 @@ char *readCompressedFile(const char *filename)
unsigned char *buffer, *cBuffer;
uint32_t l1, l2;
unsigned long length, cLength;
FILE *file = fopen(getFileLocation(filename), "rb");
FILE *file;
file = fopen(getFileLocation(filename), "rb");
buffer = 0;
cBuffer = 0;
@ -128,13 +131,17 @@ char *readCompressedFile(const char *filename)
int writeFile(const char *filename, const char *data)
{
FILE *file = fopen(filename, "wb");
FILE *file;
int result;
file = fopen(filename, "wb");
if (file)
{
fprintf(file, "%s\n", data);
result = fprintf(file, "%s\n", data);
fclose(file);
return 1;
return result == strlen(data) + 1;
}
return 0;
@ -197,7 +204,12 @@ char **getFileList(const char *dir, int *count)
int deleteFile(char *path)
{
return unlink(path) == 0;
if (fileExists(path))
{
return unlink(path) == 0;
}
return 1;
}
int renameFile(char *src, char *dest)