mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 00:33:34 +01:00
Core: Remove some uses of OpenCPPFile.
This commit is contained in:
1 parent
96c109e6ce
commit
2999e1cb86
4 files changed
+42
-54
No files matched your search
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "Common/Data/Format/IniFile.h"
|
||||
#include "Common/File/VFS/VFS.h"
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/Data/Text/Parsers.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -597,32 +598,26 @@ bool IniFile::Load(std::istream &in) {
|
||||
|
||||
bool IniFile::Save(const char* filename)
|
||||
{
|
||||
std::ofstream out;
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
out.open(ConvertUTF8ToWString(filename), std::ios::out);
|
||||
#else
|
||||
out.open(filename, std::ios::out);
|
||||
#endif
|
||||
|
||||
if (out.fail())
|
||||
{
|
||||
FILE *file = File::OpenCFile(filename, "w");
|
||||
if (!file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// UTF-8 byte order mark. To make sure notepad doesn't go nuts.
|
||||
out << "\xEF\xBB\xBF";
|
||||
// TODO: Do we still need this? It's annoying.
|
||||
fprintf(file, "\xEF\xBB\xBF");
|
||||
|
||||
for (const Section §ion : sections) {
|
||||
if (!section.name().empty() && (!section.lines.empty() || !section.comment.empty())) {
|
||||
out << "[" << section.name() << "]" << section.comment << std::endl;
|
||||
fprintf(file, "[%s]%s\n", section.name().c_str(), section.comment.c_str());
|
||||
}
|
||||
|
||||
for (const std::string &s : section.lines) {
|
||||
out << s << std::endl;
|
||||
fprintf(file, "%s\n", s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
out.close();
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user