Windows: Avoid C++ files for consistency.

There's already the mingw thing, and we're avoiding these for Android
paths too.  Let's be consistent.
This commit is contained in:
Unknown W. Brackets 2021-05-09 16:15:57 -07:00
parent fada6583c9
commit 8544bd0c3e
5 changed files with 20 additions and 30 deletions

View File

@ -15,7 +15,6 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <fstream>
#include <string>
#include <cstring>

View File

@ -15,7 +15,6 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <fstream>
#include <algorithm>
#include <set>

View File

@ -644,24 +644,21 @@ void InitSysDirectories() {
// If installed.txt exists(and we can determine the Documents directory)
if (installed && rootMyDocsPath.size() > 0) {
#if defined(_WIN32) && defined(__MINGW32__)
std::ifstream inputFile(installedFile);
#else
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
#endif
if (!inputFile.fail() && inputFile.is_open()) {
std::string tempString;
std::getline(inputFile, tempString);
FILE *fp = File::OpenCFile(installedFile, "rt");
if (fp) {
char temp[2048];
char *tempStr = fgets(temp, sizeof(temp), fp);
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
if (tempString.substr(0, 3) == "\xEF\xBB\xBF")
tempString = tempString.substr(3);
if (tempStr && strncmp(tempStr, "\xEF\xBB\xBF", 3) == 0) {
tempStr += 3;
}
std::string tempString = tempStr ? tempStr : "";
if (!tempString.empty() && tempString.back() == '\n')
tempString.resize(tempString.size() - 1);
g_Config.memStickDirectory = tempString;
fclose(fp);
}
inputFile.close();
// Check if the file is empty first, before appending the slash.
if (g_Config.memStickDirectory.empty())

View File

@ -958,25 +958,21 @@ void GameSettingsScreen::CreateViews() {
SavePathInMyDocumentChoice->SetEnabled(false);
} else {
if (installed_ && myDocsExists) {
#ifdef _MSC_VER
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
#else
std::ifstream inputFile(installedFile);
#endif
if (!inputFile.fail() && inputFile.is_open()) {
std::string tempString;
std::getline(inputFile, tempString);
FILE *testInstalled = File::OpenCFile(installedFile, "rt");
if (testInstalled) {
char temp[2048];
char *tempStr = fgets(temp, sizeof(temp), testInstalled);
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
if (tempString.substr(0, 3) == "\xEF\xBB\xBF")
tempString = tempString.substr(3);
if (tempStr && strncmp(tempStr, "\xEF\xBB\xBF", 3) == 0) {
tempStr += 3;
}
SavePathInOtherChoice->SetEnabled(!PSP_IsInited());
if (!(tempString == "")) {
if (tempStr && strlen(tempStr) != 0 && strcmp(tempStr, "\n") != 0) {
installed_ = false;
otherinstalled_ = true;
}
fclose(testInstalled);
}
inputFile.close();
} else if (!myDocsExists) {
SavePathInMyDocumentChoice->SetEnabled(false);
}

View File

@ -67,6 +67,5 @@
#include <vector>
#include <map>
#include <string>
#include <fstream>
#include "Common/Log.h"