@@ -84,13 +84,13 @@ FiosItem *FiosGetScenarioList(int *num,
void FiosFreeSavegameList(void);
// Browse to. Returns a filename w/path if we reached a file.
char *FiosBrowseTo(const FiosItem *item);
// Return path, free space and stringID
StringID FiosGetDescText(const char **path, uint32 *tot);
// Delete a name
void FiosDelete(const char *name);
bool FiosDelete(const char *name);
// Make a filename from a name
void FiosMakeSavegameName(char *buf, const char *name);
int CDECL compare_FiosItems(const void *a, const void *b);
void CreateConsole(void);
@@ -1325,13 +1325,15 @@ static void SaveLoadDlgWndProc(Window *w
if (HandleEditBoxKey(w, 9, e) == 1) /* Press Enter */
HandleButtonClick(w, 11);
}
break;
case WE_TIMEOUT:
if (HASBIT(w->click_state, 10)) { /* Delete button clicked */
FiosDelete(WP(w,querystr_d).text.buf);
if (!FiosDelete(WP(w,querystr_d).text.buf)) {
ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
SetWindowDirty(w);
BuildFileList();
if (_saveload_mode == SLD_SAVE_GAME) {
GenerateFileName(); /* Reset file name to current date */
UpdateTextBufferSize(&WP(w, querystr_d).text);
@@ -412,18 +412,18 @@ void FiosMakeSavegameName(char *buf, con
period = strrchr(name, '.');
if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
sprintf(buf, "%s\\%s%s", _fios_path, name, extension);
void FiosDelete(const char *name)
bool FiosDelete(const char *name)
{
char path[512];
snprintf(path, lengthof(path), "%s\\%s", _fios_path, name);
unlink(path);
return unlink(path) == 0;
bool FileExists(const char *filename)
return access(filename, 0) == 0;
@@ -350,18 +350,18 @@ void FiosMakeSavegameName(char *buf, con
sprintf(buf, "%s/%s%s", _fios_path, name, extension);
snprintf(path, lengthof(path), "%s/%s", _fios_path, name);
@@ -908,18 +908,18 @@ void FiosMakeSavegameName(char *buf, con
DeleteFile(path);
return DeleteFile(path) != 0;
HANDLE hand = CreateFile(filename, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hand == INVALID_HANDLE_VALUE) return false;
Status change: