Don't use wrong encoding for paths when opening streams on Windows
This commit is contained in:
parent
08da19fc87
commit
9d8a82e1d9
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "Common/CPUDetect.h"
|
#include "Common/CPUDetect.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
const char procfile[] = "/proc/cpuinfo";
|
const char procfile[] = "/proc/cpuinfo";
|
||||||
|
@ -22,7 +23,8 @@ static std::string GetCPUString()
|
||||||
std::string cpu_string = "Unknown";
|
std::string cpu_string = "Unknown";
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
std::ifstream file(procfile);
|
std::ifstream file;
|
||||||
|
File::OpenFStream(file, procfile, std::ios_base::in);
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
return cpu_string;
|
return cpu_string;
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
// failed to open file for reading or bad header
|
// failed to open file for reading or bad header
|
||||||
// close and recreate file
|
// close and recreate file
|
||||||
Close();
|
Close();
|
||||||
m_file.open(filename, ios_base::out | ios_base::trunc | ios_base::binary);
|
File::OpenFStream(m_file, filename, ios_base::out | ios_base::trunc | ios_base::binary);
|
||||||
WriteHeader();
|
WriteHeader();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -400,7 +400,7 @@ void Wiimote::ReadData(const wm_read_data* const rd)
|
||||||
{
|
{
|
||||||
// TODO Only read the Mii block parts required
|
// TODO Only read the Mii block parts required
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
file.open((File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/mii.bin").c_str(),
|
File::OpenFStream(file, (File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/mii.bin").c_str(),
|
||||||
std::ios::binary | std::ios::in);
|
std::ios::binary | std::ios::in);
|
||||||
file.read((char*)m_eeprom + 0x0FCA, 0x02f0);
|
file.read((char*)m_eeprom + 0x0FCA, 0x02f0);
|
||||||
file.close();
|
file.close();
|
||||||
|
|
|
@ -58,7 +58,8 @@ MemoryWatcher::~MemoryWatcher()
|
||||||
|
|
||||||
bool MemoryWatcher::LoadAddresses(const std::string& path)
|
bool MemoryWatcher::LoadAddresses(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream locations(path);
|
std::ifstream locations;
|
||||||
|
File::OpenFStream(locations, path, std::ios_base::in);
|
||||||
if (!locations)
|
if (!locations)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,8 @@ void CRenderFrame::OnDropFiles(wxDropFilesEvent& event)
|
||||||
bool CRenderFrame::IsValidSavestateDropped(const std::string& filepath)
|
bool CRenderFrame::IsValidSavestateDropped(const std::string& filepath)
|
||||||
{
|
{
|
||||||
const int game_id_length = 6;
|
const int game_id_length = 6;
|
||||||
std::ifstream file(filepath, std::ios::in | std::ios::binary);
|
std::ifstream file;
|
||||||
|
File::OpenFStream(file, filepath, std::ios::in | std::ios::binary);
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -21,7 +21,10 @@ FPSCounter::FPSCounter()
|
||||||
void FPSCounter::LogRenderTimeToFile(u64 val)
|
void FPSCounter::LogRenderTimeToFile(u64 val)
|
||||||
{
|
{
|
||||||
if (!m_bench_file.is_open())
|
if (!m_bench_file.is_open())
|
||||||
m_bench_file.open(File::GetUserPath(D_LOGS_IDX) + "render_time.txt");
|
{
|
||||||
|
File::OpenFStream(m_bench_file, File::GetUserPath(D_LOGS_IDX) + "render_time.txt",
|
||||||
|
std::ios_base::out);
|
||||||
|
}
|
||||||
|
|
||||||
m_bench_file << std::fixed << std::setprecision(8) << (val / 1000.0) << std::endl;
|
m_bench_file << std::fixed << std::setprecision(8) << (val / 1000.0) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue