mirror of https://github.com/OpenTTD/OpenTTD
(svn r15706) -Fix: Make sure the filename passed to unlink() is always in file system encoding.
parent
fa35dc10e5
commit
b1479bec02
|
@ -17,7 +17,6 @@
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# endif
|
# endif
|
||||||
# define access _taccess
|
# define access _taccess
|
||||||
# define unlink _tunlink
|
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
@ -161,16 +160,12 @@ void FiosMakeSavegameName(char *buf, const char *name, size_t size)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
|
||||||
# define unlink _tunlink
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool FiosDelete(const char *name)
|
bool FiosDelete(const char *name)
|
||||||
{
|
{
|
||||||
char filename[512];
|
char filename[512];
|
||||||
|
|
||||||
FiosMakeSavegameName(filename, name, lengthof(filename));
|
FiosMakeSavegameName(filename, name, lengthof(filename));
|
||||||
return unlink(OTTD2FS(filename)) == 0;
|
return unlink(filename) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileExists(const char *filename)
|
bool FileExists(const char *filename)
|
||||||
|
|
|
@ -251,6 +251,7 @@
|
||||||
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */
|
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */
|
||||||
#if !defined(WINCE)
|
#if !defined(WINCE)
|
||||||
#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
|
#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
|
||||||
|
#define unlink(file) _tunlink(OTTD2FS(file))
|
||||||
#endif /* WINCE */
|
#endif /* WINCE */
|
||||||
|
|
||||||
const char *FS2OTTD(const TCHAR *name);
|
const char *FS2OTTD(const TCHAR *name);
|
||||||
|
|
Loading…
Reference in New Issue