mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r2775) Deleting a file can fail, display an error message when it happens
This commit is contained in:
parent
fcf5ace08f
commit
fc5e2d4861
2
hal.h
2
hal.h
|
@ -87,7 +87,7 @@ 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);
|
||||
|
||||
|
|
|
@ -1328,7 +1328,9 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
|
|||
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) {
|
||||
|
|
4
os2.c
4
os2.c
|
@ -415,12 +415,12 @@ void FiosMakeSavegameName(char *buf, const char *name)
|
|||
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)
|
||||
|
|
4
unix.c
4
unix.c
|
@ -353,12 +353,12 @@ void FiosMakeSavegameName(char *buf, const char *name)
|
|||
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)
|
||||
|
|
4
win32.c
4
win32.c
|
@ -911,12 +911,12 @@ void FiosMakeSavegameName(char *buf, const char *name)
|
|||
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);
|
||||
DeleteFile(path);
|
||||
return DeleteFile(path) != 0;
|
||||
}
|
||||
|
||||
bool FileExists(const char *filename)
|
||||
|
|
Loading…
Reference in New Issue