Fix as @hrydgard suggest

This commit is contained in:
sum2012 2015-01-28 06:15:05 +08:00
parent dff76dec56
commit 008806c275

View File

@ -1,3 +1,5 @@
#include "i18n/i18n.h"
#include "UI/OnScreenDisplay.h"
#include "Common/StringUtils.h"
#include "Common/ChunkFile.h"
#include "Common/FileUtil.h"
@ -13,7 +15,7 @@
#include "util/text/utf8.h"
#endif
using namespace std;
static int CheatEvent = -1;
std::string gameTitle;
@ -41,10 +43,15 @@ static void __CheatStart() {
File::CreateFullPath(GetSysDirectory(DIRECTORY_CHEATS));
if (!File::Exists(activeCheatFile)) {
ofstream myCheatFile;
myCheatFile.open(activeCheatFile.c_str());
myCheatFile << "\xEF\xBB\xBF";
myCheatFile.close();
FILE *f = File::OpenCFile(activeCheatFile, "wb");
if (f) {
fwrite("\xEF\xBB\xBF", 1, 3, f);
fclose(f);
}
if (!File::Exists(activeCheatFile)) {
I18NCategory *err = GetI18NCategory("Error");
osm.Show(err->T("Unable to create cheat file, disk may be full"));
}
}