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:
parent
fada6583c9
commit
8544bd0c3e
5 changed files with 20 additions and 30 deletions
|
@ -15,7 +15,6 @@
|
||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
|
|
@ -644,24 +644,21 @@ void InitSysDirectories() {
|
||||||
|
|
||||||
// If installed.txt exists(and we can determine the Documents directory)
|
// If installed.txt exists(and we can determine the Documents directory)
|
||||||
if (installed && rootMyDocsPath.size() > 0) {
|
if (installed && rootMyDocsPath.size() > 0) {
|
||||||
#if defined(_WIN32) && defined(__MINGW32__)
|
FILE *fp = File::OpenCFile(installedFile, "rt");
|
||||||
std::ifstream inputFile(installedFile);
|
if (fp) {
|
||||||
#else
|
char temp[2048];
|
||||||
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
|
char *tempStr = fgets(temp, sizeof(temp), fp);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!inputFile.fail() && inputFile.is_open()) {
|
|
||||||
std::string tempString;
|
|
||||||
|
|
||||||
std::getline(inputFile, tempString);
|
|
||||||
|
|
||||||
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
|
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
|
||||||
if (tempString.substr(0, 3) == "\xEF\xBB\xBF")
|
if (tempStr && strncmp(tempStr, "\xEF\xBB\xBF", 3) == 0) {
|
||||||
tempString = tempString.substr(3);
|
tempStr += 3;
|
||||||
|
}
|
||||||
|
std::string tempString = tempStr ? tempStr : "";
|
||||||
|
if (!tempString.empty() && tempString.back() == '\n')
|
||||||
|
tempString.resize(tempString.size() - 1);
|
||||||
|
|
||||||
g_Config.memStickDirectory = tempString;
|
g_Config.memStickDirectory = tempString;
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
inputFile.close();
|
|
||||||
|
|
||||||
// Check if the file is empty first, before appending the slash.
|
// Check if the file is empty first, before appending the slash.
|
||||||
if (g_Config.memStickDirectory.empty())
|
if (g_Config.memStickDirectory.empty())
|
||||||
|
|
|
@ -958,25 +958,21 @@ void GameSettingsScreen::CreateViews() {
|
||||||
SavePathInMyDocumentChoice->SetEnabled(false);
|
SavePathInMyDocumentChoice->SetEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
if (installed_ && myDocsExists) {
|
if (installed_ && myDocsExists) {
|
||||||
#ifdef _MSC_VER
|
FILE *testInstalled = File::OpenCFile(installedFile, "rt");
|
||||||
std::ifstream inputFile(ConvertUTF8ToWString(installedFile));
|
if (testInstalled) {
|
||||||
#else
|
char temp[2048];
|
||||||
std::ifstream inputFile(installedFile);
|
char *tempStr = fgets(temp, sizeof(temp), testInstalled);
|
||||||
#endif
|
|
||||||
if (!inputFile.fail() && inputFile.is_open()) {
|
|
||||||
std::string tempString;
|
|
||||||
std::getline(inputFile, tempString);
|
|
||||||
|
|
||||||
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
|
// Skip UTF-8 encoding bytes if there are any. There are 3 of them.
|
||||||
if (tempString.substr(0, 3) == "\xEF\xBB\xBF")
|
if (tempStr && strncmp(tempStr, "\xEF\xBB\xBF", 3) == 0) {
|
||||||
tempString = tempString.substr(3);
|
tempStr += 3;
|
||||||
|
}
|
||||||
SavePathInOtherChoice->SetEnabled(!PSP_IsInited());
|
SavePathInOtherChoice->SetEnabled(!PSP_IsInited());
|
||||||
if (!(tempString == "")) {
|
if (tempStr && strlen(tempStr) != 0 && strcmp(tempStr, "\n") != 0) {
|
||||||
installed_ = false;
|
installed_ = false;
|
||||||
otherinstalled_ = true;
|
otherinstalled_ = true;
|
||||||
}
|
}
|
||||||
|
fclose(testInstalled);
|
||||||
}
|
}
|
||||||
inputFile.close();
|
|
||||||
} else if (!myDocsExists) {
|
} else if (!myDocsExists) {
|
||||||
SavePathInMyDocumentChoice->SetEnabled(false);
|
SavePathInMyDocumentChoice->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,5 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "Common/Log.h"
|
#include "Common/Log.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue